Re: using queries as default value? - Mailing list pgsql-novice

From Don Patou
Subject Re: using queries as default value?
Date
Msg-id 200305310449.18056.pknoob@noos.fr
Whole thread Raw
In response to Re: using queries as default value?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: why doesn't an index help my simple query?
Next
From: Peter Bierman
Date:
Subject: Re: why doesn't an index help my simple query?