Question

SQL Statement to Execute Before Translation Double Encoded

  • 5 August 2016
  • 8 replies
  • 4 views

Badge

Hi,

Not sure if this is a bug. 

I've found that the PostGIS writer's SQL Statement to Execute Before Translation can accidentally double encode the SQL such that it results in a fatal error on trying to write.

As a process;

  • Enter this SQL code in the advanced editor (by clicking the elipsis button on the writer's Edit Parameters pane);
FME_SQL_DELIMITER ;
DROP INDEX IF EXISTS "TEMPSpeciesSightings_Catalogue_Number_Index";
DROP INDEX IF EXISTS "TEMPSpeciesSightings_Conservation_Index";
DROP INDEX IF EXISTS "TEMPSpeciesSightings_Date_Modified_Index";
DROP INDEX IF EXISTS "TEMPSpeciesSightings_Spatial_Index";
DROP INDEX IF EXISTS "TEMPSpeciesSightings_stateConservation_Index";

  • FME encodes this to;
FME_SQL_DELIMITER<space><semicolon><lf>DROP<space>INDEX<space>IF<space>EXISTS<space><quote>TEMPSpeciesSightings_Catalogue_Number_Index<quote><semicolon><lf>DROP<space>INDEX<space>IF<space>EXISTS<space><quote>TEMPSpeciesSightings_Conservation_Index<quote><semicolon><lf>DROP<space>INDEX<space>IF<space>EXISTS<space><quote>TEMPSpeciesSightings_Date_Modified_Index<quote><semicolon><lf>DROP<space>INDEX<space>IF<space>EXISTS<space><quote>TEMPSpeciesSightings_Spatial_Index<quote><semicolon><lf>DROP<space>INDEX<space>IF<space>EXISTS<space><quote>TEMPSpeciesSightings_stateConservation_Index<quote><semicolon>

  • Click OK and then OK to exit the Parameters pane
  • Re-enter the advanced SQL editor, click OK again back out without changing anything
  • Go all the way back in and check the encoded SQL and it should look similar to this;
FME_SQL_DELIMITER<lt>space<gt><lt>semicolon<gt><lt>lf<gt>DROP<lt>space<gt>INDEX<lt>space<gt>IF<lt>space<gt>EXISTS<lt>space<gt><lt>quote<gt>TEMPSpeciesSightings_Catalogue_Number_Index<lt>quote<gt><lt>semicolon<gt><lt>lf<gt>DROP<lt>space<gt>INDEX<lt>space<gt>IF<lt>space<gt>EXISTS<lt>space<gt><lt>quote<gt>TEMPSpeciesSightings_Conservation_Index<lt>quote<gt><lt>semicolon<gt><lt>lf<gt>DROP<lt>space<gt>INDEX<lt>space<gt>IF<lt>space<gt>EXISTS<lt>space<gt><lt>quote<gt>TEMPSpeciesSightings_Date_Modified_Index<lt>quote<gt><lt>semicolon<gt><lt>lf<gt>DROP<lt>space<gt>INDEX<lt>space<gt>IF<lt>space<gt>EXISTS<lt>space<gt><lt>quote<gt>TEMPSpeciesSightings_Spatial_Index<lt>quote<gt><lt>semicolon<gt><lt>lf<gt>DROP<lt>space<gt>INDEX<lt>space<gt>IF<lt>space<gt>EXISTS<lt>space<gt><lt>quote<gt>TEMPSpeciesSightings_stateConservation_Index<lt>quote<gt><lt>semicolon<gt>

Note all the previous encoding is doubly encoded. For example, <space> is now <lt>space<gt>.

If I were to accept this statement and try and run the workspace the write will fail with a syntax error.

Thanks.


8 replies

Userlevel 4
Badge +25
Hi - it sure sounds like a bug, but I can't replicate it, and I can't find any other reports of this issue. So I am going to ask our development team to look at this question and see what they say.

 

Userlevel 4
Badge +25
I forgot to ask - what version/build of FME are you using?

 

 

Badge

 

Hi, thanks for looking into it.

 

I'm using FME Desktop 2016.1 on Windows.

 

I caused the behaviour by clicking the PostGIS writer's parameter editing button (the one that appears above the writer when you hover over it) more than once.

 

Thanks again.

 

 

Userlevel 4

Just tested this with 2016.1.0.1 (build 16494 win32) and was unable to reproduce the error. Did the following repeatedly:

Maybe try re-creating the writer?

Userlevel 4
Badge +25
No, I still can't get it to fail as described, and our developers tell me that - while they have seen this before - there should be no problem in 2016.1

 

I think it might take more testing than is feasible here. Maybe you could file this as a support case (safe.com/support) and include your workspace so they can try it out? That is, if it only occurs in this workspace and not in any others.

 

Badge
Thanks Mark, I'll raise a support case as you suggest.

 

This isn't causing any problems executing the workspace as it's a relatively simple matter to avoid opening and closing the parameters dialog repeatedly.

 

Thanks for all your help.

 

Aiden

 

Badge

Just tested this with 2016.1.0.1 (build 16494 win32) and was unable to reproduce the error. Did the following repeatedly:

Maybe try re-creating the writer?

I'm using 2016.1.0 on WIN64. Perhaps that's part of the difference?

 

 

Badge
This bug seems to have stopped affecting me now.

 

 

The solution could have been either of two things that I've done in the intervening time;

 

1. I updated FME Desktop to 2016.1.1

 

2. I pushed the workspace up to FME Server and then pulled it back down again

 

 

Either way I'm happy now. Thanks for your help.

 

Aiden

Reply