Re: doing VALID UNTIL programmatically in SQL ?

From: "Jimmie H(dot) Apsey" <japsey(at)futuredental(dot)com>
To: "Karsten Hilbert" <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, "GNUmed list" <Gnumed-devel(at)gnu(dot)org>
Subject: Re: doing VALID UNTIL programmatically in SQL ?
Date: 2003-06-11 13:41:08
Message-ID: 3EE73174.8070901@futuredental.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think it has to be done like this: "now() + '@ 6 month' as
six_months_from_now;" which yields

six_months_from_now
------------------------
2003-12-11 09:38:24-05
(1 row)

Jim Apsey
--------------------------------------------------------------------------------------
Karsten Hilbert wrote:

>Hi all,
>
>in a psql script for GnuMed (www.gnumed.org) I am using a
>snippet like the following for setting up predefined test
>accounts:
>
>CREATE USER "test-doc"
> WITH PASSWORD 'test-doc'
> IN GROUP "gm-doctors", "gm-public"
> VALID UNTIL '2003-09-30'
>;
>
>I would like to constrain their validity to, say, six months. I
>have tried but not found a way to tell the VALID UNTIL clause
>something like
>
> now() + '6 months'::interval
>
>Anyone have a suggestion (short of calculating in the client at
>runtime and substituting) on how to do this in plain SQL ?
>
>Thanks a lot,
>
>Karsten Hilbert, MD
>GnuMed i18n coordinator
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rory Campbell-Lange 2003-06-11 13:52:55 Return Record with CASE problem
Previous Message Tom Lane 2003-06-11 13:32:05 Re: doing VALID UNTIL programmatically in SQL ?