Solved

SQLExecutor error exposing feature attribute

  • 14 November 2019
  • 7 replies
  • 2 views

Badge

I try to extract values from a Postgresql 12 DB (to populate another pg table) by matching a feature attribute.

"pk_numart" (column)

"editor"."articles" (schema.table)

"codarticle" (column)

 

The query : 

SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = @Value(Mesure)

 

Then I get the following error : 

Executing custom data query: 'SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = 13.E'
Error executing SQL command ('declare "editor_custom_query_crsr" cursor for SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = 13.E'): 'ERREUR:  erreur de syntaxe sur ou près de « E »
LINE 1: ...k_numart" FROM "editor"."articles" WHERE "codarticle" = 13.E

Seems that the point causes the query to fail. I've tried several combinations, with or without hyphen before query or delimiter, but still no luck. 

Thanks already for any help.

icon

Best answer by itay 14 November 2019, 18:45

View original

7 replies

Badge +16

Hi @acusig,

what about:

SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = '@Value(Mesure) '

Badge

Hi @itay,

Yes, I already tried with single quotes around the feature attribute as well as CAST(@Value(Mesure) as varchar) to be sure I'm dealing with a string but always the same error message. One can see a little vertical arrow under the point to locate the issue. Dunno if it's of any help ...

Thanks for your help

Userlevel 1
Badge +10

Hi @acusig!  What is the datatype of the "codarticle" field in the database?  

Are you able to run this query successfully in another application? 

SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = '13.E' 
Badge

Hi @acusig!  What is the datatype of the "codarticle" field in the database?  

Are you able to run this query successfully in another application? 

SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = '13.E' 

Hi @nampreetatsafe, The datatype is string and I'm able to query the DB through pgAdmin4. I'm banging my head against the wall trying to understand what's happening ...

Userlevel 1
Badge +21

Hi @nampreetatsafe, The datatype is string and I'm able to query the DB through pgAdmin4. I'm banging my head against the wall trying to understand what's happening ...

Can you post the error message you get when adding the quotes as shown in itay's answer. The "Executing custom data query" should show exactly what is being sent.

Badge

Can you post the error message you get when adding the quotes as shown in itay's answer. The "Executing custom data query" should show exactly what is being sent.

@ebygomm, the output log extract :

Executing custom data query: 'SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = '1.A' '

I join a more significant part of the log file as attachment.

20191120-sqlexecutor-issue.txt

Userlevel 1
Badge +10

@ebygomm, the output log extract :

Executing custom data query: 'SELECT "pk_numart" FROM "editor"."articles" WHERE "codarticle" = '1.A' '

I join a more significant part of the log file as attachment.

20191120-sqlexecutor-issue.txt

@acusig, are you getting the error in the logfile? I don't see it in the log you provided. It would be helpful to get the entire log if possible, or at least a significant portion before and after the error you mentioned in your original description above. Thanks!

Reply