Re: function query error: column does not exist - Mailing list pgsql-general

From Alban Hertroys
Subject Re: function query error: column does not exist
Date
Msg-id CAF-3MvNRzGPzc_GkRPom-+Ccrine7fh01kpx+rGJGbmZG2vSdQ@mail.gmail.com
Whole thread Raw
In response to function query error: column does not exist  (giozh <giozh@yahoo.it>)
List pgsql-general
On 11 July 2013 11:01, giozh <giozh@yahoo.it> wrote:
this is the insert code:

>EXECUTE 'INSERT INTO table VALUES('||value1||','[...]','||value_char||')';

and the error is on value_char. pg told me that "column does not exist".

A few suggestions:

1. Post a statement that actually matches your problem statement. What you posted can't possibly work as [...] is not valid SQL syntax. Post the actual query. You can replace table names and column names and such with example names, if/where necessary.

2. Show the actual error message instead of some interpretation; the actual message would have mentioned the name of the column that doesn't exist. That would have been useful info.

3. Don't concatenate values into a dynamic query, use USING instead so that the values get properly escaped and don't open you up for SQL injection issues.

The problem you ran into was possibly (we really can't tell from the info you provided) an error in how you quote the various parts of the query, or one of your variables/parameters had a value that contained a quote.

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

pgsql-general by date:

Previous
From: Jayadevan M
Date:
Subject: Re: pg recovery
Next
From: Michael Paquier
Date:
Subject: Re: pg recovery