Re: doing VALID UNTIL programmatically in SQL ? - Mailing list pgsql-general

From Tom Lane
Subject Re: doing VALID UNTIL programmatically in SQL ?
Date
Msg-id 10495.1055338325@sss.pgh.pa.us
Whole thread Raw
In response to doing VALID UNTIL programmatically in SQL ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
> I have tried but not found a way to tell the VALID UNTIL clause
> something like
>     now() + '6 months'::interval

CREATE USER, like pretty much all utility statements in Postgres,
won't do any expression evaluation --- the parameters have to be
simple literal constants.

The only workaround I can think of is to do the CREATE USER inside
a helper plpgsql function that does the time calculation and then
uses EXECUTE to run the command with the appropriate values plugged
in.  It seems unlikely that this is a cleaner solution than doing it
in the client code ...

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: RE : PostgreSQL coredump : Couldn't find any tables,
Next
From: "Jimmie H. Apsey"
Date:
Subject: Re: Multilple email being delivered