psql internal variables

From: Thor Tall <tall_thor(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: psql internal variables
Date: 2006-08-07 12:56:25
Message-ID: 20060807125625.18394.qmail@web50314.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

It looks as if psql has internal variables I am how
ever not able to get it to work in the way I want.

I need to store the current date and then delete all
elements from 3 tables based on the same date.

I tried to set the variable curtime:

set curtime now()

but I could not use it in a delete:

delete from table_a where ts_date < curtime;

If I just delete from table_a and then table_b and the
table_c I may risk deleting rows in table_b and
table_c which correspond to rows in table_a. (due to
the different times returned by now();
I would have used on delete cascade but I can not due
to the way that the data is generated for the tables.

Thanks for any help you may provide,
/Thor

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harald Armin Massa 2006-08-07 13:41:20 Re: could not open relation - why?
Previous Message Tom Lane 2006-08-07 12:46:09 Re: could not open relation - why?