From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | jpat(at)mywayhealth(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: date bug |
Date: | 2001-05-16 22:59:40 |
Message-ID: | 28774.990053980@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"Jeff Patterson" <jpat(at)mywayhealth(dot)com> writes:
> Strange date behavior as shown below.
This is not a date bug; it's your misunderstanding of how SQL functions
work. A function that returns a scalar can only return one result, so
it makes no sense to try to define its result as a SELECT from a
multi-row table.
As it happens, what you get is the result from the first row returned
by the SELECT. (Personally I'd have thought it'd make more sense to
raise an error if the SELECT returns multiple rows, but we'd probably
break existing applications if we changed it.)
Perhaps you want something on the order of
SELECT EXISTS(SELECT 1 FROM holidays WHERE date = $1)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2001-05-16 23:32:34 | Re: orphaned trigger |
Previous Message | Jonathan Ellis | 2001-05-16 22:57:34 | Re: orphaned trigger |