Re: [SQL] Differentiate Between Zero-Length String and NULL Column Values

2007-01-29 Thread Michael Fuhr
On Tue, Jan 30, 2007 at 04:32:22PM +1100, Phillip Smith wrote: > The second row (401600) is what I'm interested in for this particular > problem. The problem is when I try and add a WHERE clause: > SELECT * FROM tmpstk WHERE ean = ''; > SELECT * FROM tmpstk WHERE TRIM(ean) = ''; >

[SQL] Differentiate Between Zero-Length String and NULL Column Values

2007-01-29 Thread Phillip Smith
Hi All, Small problem with 8.2.1, I have a temp table of basic stock details: CREATE TEMP TABLE tmpstk ( code varchar(6), description varchar(38), grp varchar(4), brand text, style text, supplier varchar(6), supp

Re: [SQL] Function returning SETOF using plpythonu

2007-01-29 Thread Adrian Klaver
On Monday 29 January 2007 6:12 am, Luís Sousa wrote: > Thanks :-) > That worked fine. > > >plpy.execute returns dictionary, and you need a list. You may try this: > > > >CREATE FUNCTION "test_python_setof"() > >RETURNS SETOF text AS ' > >records=plpy.execute("SELECT name FROM interface"); > >

Re: [SQL] Function returning SETOF using plpythonu

2007-01-29 Thread Luís Sousa
Thanks :-) That worked fine. plpy.execute returns dictionary, and you need a list. You may try this: CREATE FUNCTION "test_python_setof"() RETURNS SETOF text AS ' records=plpy.execute("SELECT name FROM interface"); return [ (r["name"]) for r in records] ' LANGUAGE 'plpythonu'; Then

Re: [SQL] Very strange postgresql behaviour

2007-01-29 Thread Andrew Sullivan
On Mon, Jan 29, 2007 at 01:21:13PM +0100, Arnau wrote: > Hi all, > > I have postgresql 7.4.2 running on debian and I have the oddest > postgresql behaviour I've ever seen. I think before you get any help here, you're going to need to upgrade to at least the latest in the 7.4 series. 7.4.2 was

[SQL] Very strange postgresql behaviour

2007-01-29 Thread Arnau
Hi all, I have postgresql 7.4.2 running on debian and I have the oddest postgresql behaviour I've ever seen. I do the following queries: espsm_asme=# select customer_app_config_id, customer_app_config_name from customer_app_config where customer_app_config_id = 5929 or customer_app_config_id