[SQL] libpq

2010-08-10 Thread Dmitriy Igrishin
Hey all, Is it guaranteed that functions, which accept PGconn* properly works if PGconn* is NULL (or just 0) and returns in such cases the same values as for not-NULL PGconn* ? If so, I think it should be documented ?! Regards, Dmitriy

[SQL] type cast

2010-08-10 Thread Imre Horvath
Hi! I don't know if it's the right place or the psycopg2 list: I've got a plpython function, with a character varying param. I can call it from sql. But when i try to call it with psycopg2.callproc('testfunc', ['test']), i've got the error: function testfunc(unknown) does not exist HINT: No

Re: [SQL] type cast

2010-08-10 Thread Peter Eisentraut
On tis, 2010-08-10 at 18:38 +0200, Imre Horvath wrote: Hi! I don't know if it's the right place or the psycopg2 list: I've got a plpython function, with a character varying param. I can call it from sql. But when i try to call it with psycopg2.callproc('testfunc', ['test']), i've got the

Re: [SQL] type cast

2010-08-10 Thread Tom Lane
Imre Horvath blemi...@gmail.com writes: I've got a plpython function, with a character varying param. I can call it from sql. But when i try to call it with psycopg2.callproc('testfunc', ['test']), i've got the error: function testfunc(unknown) does not exist HINT: No function matches the

[SQL] Duplicate rows

2010-08-10 Thread Edward W. Rouse
Is there any way to remove a duplicate row from a table? Not my db but I have to work with it. On version 7.4 right now. Edward W. Rouse Comsquared System, Inc. 770-734-5301

Re: [SQL] Duplicate rows

2010-08-10 Thread Andreas Kretschmer
Edward W. Rouse ero...@comsquared.com wrote: Is there any way to remove a duplicate row from a table? Not my db but I have to work with it. On version 7.4 right now. How to select the right records? You can try to use the ctid-column, see my simple example: test=# select * from dups ; i

Re: [SQL] Duplicate rows

2010-08-10 Thread msi77
A few ways to do this: http://www.sql-ex.ru/help/select17.php Is there any way to remove a duplicate row from a table? Not my db but I have to work with it. On version 7.4 right now. Edward W. Rouse Comsquared System, Inc. 770-734-5301 -- Sent via pgsql-sql mailing list

Re: [SQL] Duplicate rows

2010-08-10 Thread Edward W. Rouse
I am trying to test this but get an error. select ctid, * from test where id 300 order by id, ctid; ERROR: could not identify an ordering operator for type tid HINT: Use an explicit ordering operator or modify the query. If I do a select I get this: select ctid, * from test where id

Re: [SQL] Duplicate rows

2010-08-10 Thread Edward W. Rouse
Solved. Because this is a 7.4 version and we used with oids by default, I can use the oids instead of the ctid to remove the duplicates. Thanks. Edward W. Rouse -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Edward W. Rouse

[SQL] Using count on a join, group by required?

2010-08-10 Thread Jose Ildefonso Camargo Tolosa
Greetings! First: This is working, I just need a clarification on concept, so, it is not necessary for you to look deeply at the SQL statement. I have this: Table: products that references manufacturer via products.manufacturer_id to manufacturer.id (not important, just informative). Table:

Re: [SQL] Duplicate rows

2010-08-10 Thread A. Kretschmer
In response to Edward W. Rouse : Solved. Because this is a 7.4 version and we used with oids by default, I can use the oids instead of the ctid to remove the duplicates. Yeah, that's right ;-) Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -