psql internal variables
psql internal variables
От:
Thor Tall <tall_thor@yahoo.com>
Дата:
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
Re: psql internal variables
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Thor Tall wrote: > 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(); now() returns a constant value in a transaction. -- Peter Eisentraut http://developer.postgresql.org/~petere/