Weird SQL error message

Doug Easterbrook doug at artsman.com
Thu Feb 3 17:10:19 UTC 2022


Denmark is a value.   so you want to. use ‘Denmark’.  (single quotes)


double quotes, in postgres , are used mainly to denote  Mixed Case columns if you have implemented that


eg this should work


select state_type from fcstates where state_country=‘Denmark’

which is the same as any of the following because without the “ (double quotes),  postgres always uses lower case for names of tables and fields

select STATE_TYPE from FCSTATES where STATE_COUNTRY=‘Denmark’
select State_Type from Fcstates where State_Country=‘Denmark’




SO it is NOT the same as putting double quotes around the field names because

select “State_Type" from “Fcstates" where “state_country"=‘Denmark’

will not work since postgres allows you to make case sensitive field names (using the double quote)




recap
- double quotes for field and tables (if you Use case sensitive)
- single quotes for text constants


Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On February 3, 2022, at 9:03 AM, Das Goravani <goravanis at gmail.com> wrote:
> 
> 
> I’m getting a weird error message when trying to do simple SQL.
> 
> I am searching my "states" database for the states of Denmark for example.
> 
> I am getting this error message in NATIVETEXT:
> 
> ERROR:  column "Denmark" does not exist
> LINE 1: ...tate_type" FROM "fcstates"   WHERE state_country = "Denmark"
>                                                              ^
> 
> It says "column" Denmark does not exist.
> 
> Denmark is not a column, it’s a value for the "state_country" column, it’s a search value, not a column name.
> 
> The error comes up from this line of code:
> 
> Do plist.$select(pwhereclause) Returns #F
> 
> plist is a reference to a list name, which is in an instance variable from the JS form. 
> 
> pWhereClause equals: WHERE state_country = "Denmark"
> 
> This code and this search have worked much before in window versions of the same application. 
> 
> I am logging on in my remote task construct. I have my session object and statement object variables in the remote task so that they are there for the JS forms to use. 
> 
> I don’t get what to do with this error message. It seems wrong. 
> 
> Any ideas?
> 
> Das
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list