Re: generating dynamic queries using pl/pgsql

Поиск
Список
Период
Сортировка
От Sean Davis
Тема Re: generating dynamic queries using pl/pgsql
Дата
Msg-id D3DEBB8D-6B0B-11D9-9D53-000D933565E8@mail.nih.gov
обсуждение исходный текст
Ответ на Re: generating dynamic queries using pl/pgsql  (sarlav kumar <sarlavk@yahoo.com>)
Ответы Re: generating dynamic queries using pl/pgsql
Список pgsql-novice
On Jan 20, 2005, at 12:40 PM, sarlav kumar wrote:

> >Yes, it's possible.
>
> >http://www.postgresql.org/docs/7.4/interactive/plpgsql-
> statements.html#PLPGSQL->STATEMENTS-EXECUTING-DYN
> >The manual has some great information.
>  
> I read through the manual. But I am still not clear how to actually
> generate the "queries" dynamically. In my case, some of the
> "select queries" that I want to dynamically generate have joins and
> some of the "select queries" are just from one table.
>

The point of section 37.6.4 (see the manual again) is that you can
build a query from a combination of text and variables.  If you have
pieces of your query, you need to build up the full query using the ||
operator (concatenation).  Then you can EXECUTE it.

As for "dumping" the table, look at:

http://www.postgresql.org/docs/7.4/interactive/sql-copy.html

You can use COPY to do this.

HTH,
Sean


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

Предыдущее
От: sarlav kumar
Дата:
Сообщение: Re: generating dynamic queries using pl/pgsql
Следующее
От: "Van Ingen, Lane"
Дата:
Сообщение: What Do I Need to Get Started with PostreSQL for Win32 (version 8.0)