Re: dynamic table names
От | Alban Hertroys |
---|---|
Тема | Re: dynamic table names |
Дата | |
Msg-id | 3B0D7BBA-B08A-4019-8CEB-8287E89ECDB9@gmail.com обсуждение исходный текст |
Ответ на | dynamic table names (John Smith <jayzee.smith@gmail.com>) |
Список | pgsql-general |
On Jul 17, 2013, at 22:39, John Smith <jayzee.smith@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.
В списке pgsql-general по дате отправления: