Output of PL/PGSQL?

Поиск
Список
Период
Сортировка
От David
Тема Output of PL/PGSQL?
Дата
Msg-id 0b10811b45ea1f805d8117f4e1885847@talamh.org.uk
обсуждение исходный текст
Ответы Re: Output of PL/PGSQL?
Список pgsql-novice
Hi

Is it possible to create output from a PL/PGSQL function that looks
like the output of a query? (And how do you do it?)

I want to write dynamic SQL based on some inputs from a web form and
then hand the query results back to the web app. I'm using Zope/Psycopg
on the web layer and it does the mapping of the query columns to
variables in Zope for me, when running plain queries. But a PL/PGSQL
function by default always creates a result with "one column" (named
after the function).

I have an idea how I can format the resulting rows, but I could not
find how I could change the "header". Assuming I can customise the
header, is there a standard way to output also the resulting rows as if
they come from a plain query? (Plain query being a SELECT FROM
statement, instead of a FUNCTION call.)

Also, would a PL/PGSQL function necessarily be a lot slower then a
plain query? (I could write a bunch of queries to cover all possible
input from the form and use Zope to decided which one to run, but this
looks less elegant to me.)

Thanks

DR


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

Предыдущее
От: Andrew Hammond
Дата:
Сообщение: Re: comparison trigger function
Следующее
От:
Дата:
Сообщение: Cascade Delete To Override Table Restrict Delete