dynamic table names

Поиск
Список
Период
Сортировка
От John Smith
Тема dynamic table names
Дата
Msg-id CAMZ8qd9+s_KDNmq18CjU5AXk+MVN3SPSqscEeirtgdt0RRx_Zw@mail.gmail.com
обсуждение исходный текст
Ответы Re: dynamic table names  (Rob Sargent <robjsargent@gmail.com>)
Re: dynamic table names  (Rob Sargent <robjsargent@gmail.com>)
Re: dynamic table names  (David Johnston <polobo@yahoo.com>)
Re: dynamic table names  (Thomas Kellerer <spam_eater@gmx.net>)
Re: dynamic table names  (Alban Hertroys <haramrae@gmail.com>)
Re: dynamic table names  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
guys,

have to use legacy 8.1.

i have 100,000 tables in a schema that need to be queried (optimizing this by combining them into one will have to wait).

so my query goes like so:

> 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 someone have a stored procedure for this?

http://www.postgresql.org/docs/8.1/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/message-id/aa44f4a30510071254p46064ca0vff639cd492b22c0b@mail.gmail.com
http://stackoverflow.com/questions/5772699/postgresql-dynamic-table-access
http://www.sql-workbench.net/

thanks, jzs

В списке pgsql-general по дате отправления:

Предыдущее
От: rox
Дата:
Сообщение: What are my options to avoid a Row Exclusive/RowShareLock conflict/ is there a better way?
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: dynamic table names