PDA

View Full Version : timestamp


ill
02-14-02, 07:04
in PhpPgAdmin i have this:

function arguments returns language
a1 timestamp int2 plpgsql




DECLARE
vdt ALIAS FOR $1;
BEGIN
INSERT INTO rbt_g1_i60 SELECT vdt,max(1*p_1142+0),avg(1*p_1143+0) FROM rbt_g1_i5 WHERE dt>( TIMESTAMP (''''||vdt ||'''') - INTERVAL ' 60 SECONDS')AND dt<=vdt;
RETURN 0;
END;


... and i'm not able to transfer this function, so i can paste it into psql. there's too much '''''' for me. can anyone help me ?

eperich
02-14-02, 07:56
why don't you write it in a file and
execute this with
psql -d [DB] -U [user] -f [file]

then the function will be created without problems

Is this what you want or am I missing a point.

ill
02-14-02, 08:56
coming very fast from mssql, missing the GUI, missing dateadd... that what i needed.thx

eperich
02-14-02, 09:02
There is a good tutorial at
techdocs.postgresql.org

I think this is what you need

TIME DATE FAQ (http://techdocs.postgresql.org/techdocs/faqdatesintervals.php)