Re: using queries as default value?

Поиск
Список
Период
Сортировка
От Don Patou
Тема Re: using queries as default value?
Дата
Msg-id 200305310449.18056.pknoob@noos.fr
обсуждение исходный текст
Ответ на Re: using queries as default value?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
> Not directly, but you can fake it by hiding the query in an SQL or PL
> function that you call in the DEFAULT expression.

I tried this:

CREATE FUNCTION somefunc() RETURNS integer AS '
BEGIN
    select count(colx) from anothertable;
END;
is it the right syntax?
also, how do I call my function as a default value, do I just need to "default
somefunc()" at the end of the column?

one more question, I couldn't find in the documentation how to dump databases
in a text file. could u give me the syntax?

thanx in advance





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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: why doesn't an index help my simple query?
Следующее
От: Peter Bierman
Дата:
Сообщение: Re: why doesn't an index help my simple query?