Skip to main content
Solved

SQLExecutor error exposing feature attribute

  • November 14, 2019
  • 7 replies
  • 19 views

acusig
Participant
Forum|alt.badge.img+1

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.

Best answer by itay

Hi @acusig,

what about:

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • Best Answer
  • November 14, 2019

Hi @acusig,

what about:

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


acusig
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • 11 replies
  • November 15, 2019

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


nampreetatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • 383 replies
  • November 20, 2019

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' 

acusig
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • 11 replies
  • November 20, 2019

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 ...


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 20, 2019

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.


acusig
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • 11 replies
  • November 20, 2019

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


nampreetatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • 383 replies
  • November 21, 2019

@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!