On Jul 17, 2013, at 22:39, John Smith <jayzee.sm...@gmail.com> wrote:

> so my query goes like so:
> 
> > execute 'select * from ' || tabname::regclass || ' where firstname = 
> > "john"' into e;

Are those quotes around 'john' double-quotes (for identifiers) or double 
single-quotes (for literals)?

They look like double-quotes to me, so unless your table has a column named 
"john" (and lowercase at that) that would fail. It's probably not what you 
meant anyway.

Does this fare any better?
execute 'select * from ' || tabname::regclass || ' where firstname = ''john''' 
into e;

> but i am getting an error:
> 
> > ERROR: syntax error at or near "'select * from '" at character 9

Do you always get that error or do you only get it with certain table names? If 
so, which ones?

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to