Re: [GENERAL] PL/pgSQL & OVERLAPS operator (SOLVED!)

2010-03-24 Thread Tuo Pe
--- On Tue, 3/23/10, Tom Lane wrote: > Yeah --- that SELECT will result in no change to the > variables, ie, > they'll still be NULL.  So the OVERLAPS always fails. Tom & Andreas, I thank you for your help. Renaming the variables solved the problem. :-) Regards, Tuo -- Sent via pgsql-gener

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tom Lane
"A. Kretschmer" writes: > In response to Tuo Pe : >> CREATE OR REPLACE FUNCTION TryOverlap(text, text) RETURNS boolean AS $$ >> DECLARE >> ts_start timestamp with time zone := CAST ($1 AS TIMESTAMP WITH TIME ZONE); >> ts_end timestamp with time zone := CAST ($2 AS TIMESTAMP WITH TIME ZONE); >> alk

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tuo Pe
--- On Tue, 3/23/10, A. Kretschmer wrote: > You have alku and loppu as variable and as table-column, > that's a bad > idea, maybe that's an error, i'm not sure. > > Btw.: you can use the PERIOD-datatype: I will look into it. Thanks for the tip. Tuo -- Sent via pgsql-general mailing

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread A. Kretschmer
In response to Tuo Pe : > Hello! > > I am teaching myself PL/pgSQL. I am trying to write a function that tests > whether two time periods overlap. I want to test the function parameters > against these two values in "overlaptest" table: > > select * from overlaptest; > id |alku

[GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tuo Pe
Hello! I am teaching myself PL/pgSQL. I am trying to write a function that tests whether two time periods overlap. I want to test the function parameters against these two values in "overlaptest" table: select * from overlaptest; id |alku |loppu +---