Re: [GENERAL] select where not exists returning multiple rows?

2011-11-12 Thread Jeff Davis
On Tue, 2011-11-01 at 10:59 -0400, Chris Dumoulin wrote: Indexes: item_pkey PRIMARY KEY, btree (sig) And we're doing an insert like this: INSERT INTO Item (Sig, Type, Data) SELECT $1,$2,$3 WHERE NOT EXISTS ( SELECT NULL FROM Item WHERE Sig=$4) In this case $1 and $4 should always

[GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Chris Dumoulin
We're using postgresql 9.1, and we've got a table that looks like this: testdb=# \d item Table public.item Column | Type | Modifiers ---+--+--- sig | bigint | not null type | smallint | data | text | Indexes: item_pkey PRIMARY KEY, btree (sig) And

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Merlin Moncure
On Wed, Nov 2, 2011 at 6:22 AM, Chris Dumoulin ch...@blaze.io wrote: We're using postgresql 9.1, and we've got a table that looks like this: testdb=# \d item Table public.item  Column   |   Type   | Modifiers ---+--+---  sig   | bigint   | not null  type  | smallint |  

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Chris Dumoulin
On 11-11-02 08:49 AM, Merlin Moncure wrote: On Wed, Nov 2, 2011 at 6:22 AM, Chris Dumoulinch...@blaze.io wrote: We're using postgresql 9.1, and we've got a table that looks like this: testdb=# \d item Table public.item Column | Type | Modifiers ---+--+--- sig |

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Martijn van Oosterhout
On Wed, Nov 02, 2011 at 07:22:09AM -0400, Chris Dumoulin wrote: And we're doing an insert like this: INSERT INTO Item (Sig, Type, Data) SELECT $1,$2,$3 WHERE NOT EXISTS ( SELECT NULL FROM Item WHERE Sig=$4) In this case $1 and $4 should always be the same. FWIW, If they're always going to

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Chris Dumoulin
On 11-11-02 09:13 AM, Martijn van Oosterhout wrote: On Wed, Nov 02, 2011 at 07:22:09AM -0400, Chris Dumoulin wrote: And we're doing an insert like this: INSERT INTO Item (Sig, Type, Data) SELECT $1,$2,$3 WHERE NOT EXISTS ( SELECT NULL FROM Item WHERE Sig=$4) In this case $1 and $4 should

Re: [GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Merlin Moncure
On Wed, Nov 2, 2011 at 8:20 AM, Chris Dumoulin ch...@blaze.io wrote: On 11-11-02 09:13 AM, Martijn van Oosterhout wrote: On Wed, Nov 02, 2011 at 07:22:09AM -0400, Chris Dumoulin wrote: And we're doing an insert like this: INSERT INTO Item (Sig, Type, Data) SELECT $1,$2,$3 WHERE NOT EXISTS (

[GENERAL] select where not exists returning multiple rows?

2011-11-02 Thread Chris Dumoulin
We're using postgresql 9.1, and we've got a table that looks like this: testdb=# \d item Table public.item Column | Type | Modifiers ---+--+--- sig | bigint | not null type | smallint | data | text | Indexes: item_pkey PRIMARY KEY, btree (sig) And