Re: [SQL] The empty list?

2006-11-03 Thread Aaron Bono
On 11/3/06, Jesper Krogh <[EMAIL PROTECTED]> wrote: ... but missing SQL for the empty list basically means thatwe cant handle the empty set encoded in the empty array withoutexplicitly introducing code for this size of array. From aprogramatically viewpoint, this seems quite odd. Somebody, somewher

Re: [SQL] The empty list?

2006-11-02 Thread Tom Lane
Jesper Krogh <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> FWIW, as of 8.2 the best option will probably be to use >> "col = ANY (array)", which does support zero-length arrays >> if you use either an out-of-line parameter or an array literal. > That looks nice.. is ANY in the SQL-spec? ANY is

Re: [SQL] The empty list?

2006-11-02 Thread Jesper Krogh
Tom Lane wrote: > Jesper Krogh <[EMAIL PROTECTED]> writes: >> ... the right-hand-side of on >> in operation will allways be a list (if I havent forgotten something). > > IN (SELECT ...) for one thing. Isn't that "just" a list of rows(complex value) instead of an list of types(simple values)? >>

Re: [SQL] The empty list?

2006-11-02 Thread Tom Lane
Jesper Krogh <[EMAIL PROTECTED]> writes: > ... the right-hand-side of on > in operation will allways be a list (if I havent forgotten something). IN (SELECT ...) for one thing. > ... but missing SQL for the empty list basically means that > we cant handle the empty set encoded in the empty array

Re: [SQL] The empty list?

2006-11-02 Thread Jesper Krogh
Aaron Bono wrote: > On 11/2/06, Tom Lane <[EMAIL PROTECTED]> wrote: >> >> Jesper Krogh <[EMAIL PROTECTED]> writes: >> > Whereas this gives a syntax error: >> >> > # select 1 in (); >> > ERROR: syntax error at or near ")" at character 14 >> > LINE 1: select 1 in (); >> > ^ >> >

Re: [SQL] The empty list?

2006-11-02 Thread Aaron Bono
On 11/2/06, Tom Lane <[EMAIL PROTECTED]> wrote: Jesper Krogh <[EMAIL PROTECTED]> writes:> Whereas this gives a syntax error:> # select 1 in ();> ERROR:  syntax error at or near ")" at character 14 > LINE 1: select 1 in ();>  ^I think the short answer why the spec disallows this

Re: [SQL] The empty list?

2006-11-02 Thread Tom Lane
Jesper Krogh <[EMAIL PROTECTED]> writes: > Whereas this gives a syntax error: > # select 1 in (); > ERROR: syntax error at or near ")" at character 14 > LINE 1: select 1 in (); > ^ If we took that syntax it would probably mean a zero-element row, not an empty IN list. But I

[SQL] The empty list?

2006-11-02 Thread Jesper Krogh
Hi. Is there someone who can elaborate on why the "empty list" is'nt implemented in Postgresql? This works: # select 1 in (1,2,3); ?column? -- t (1 row) And this works: jesper=# select * from test; id (0 rows) jesper=# select 1 in (select id from test); ?column? -- f (