Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-16 Thread Pavel Stehule
Hello 2008/7/16 Milan Oparnica <[EMAIL PROTECTED]>: > Milan Oparnica wrote: >> >> It's simply to complicated to return recordsets through server-side stored >> procedures. They are obviously designed to do complex data manipulation, >> returning few output variables informing the caller about fina

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-16 Thread Milan Oparnica
Milan Oparnica wrote: It's simply to complicated to return recordsets through server-side stored procedures. They are obviously designed to do complex data manipulation, returning few output variables informing the caller about final results. Returning records through sets of user-defined-typ

[SQL] pg_advisory_lock(bigint) vs. LOCK TABLE

2008-07-16 Thread Volkan YAZICI
Hi, What's the difference between below two queue implementations? -- -- With advisory locks. -- BEGIN; SELECT pg_advisory_lock((SELECT oid FROM pg_class WHERE relname = 'queue')); DELETE FROM queue WHERE id = (SELECT MI

Re: [SQL] Problem with ORDER BY and DISTINCT ON

2008-07-16 Thread Steve Midgley
At 07:29 AM 7/16/2008, Tom Lane wrote: Steve Midgley <[EMAIL PROTECTED]> writes: Interesting. You realize of course that sorting by the same expression twice is completely redundant? I haven't dug through the code yet but Thanks Tom. Yeah, I was a little embarrassed to throw this code up on

Re: [SQL] How to GROUP results BY month

2008-07-16 Thread Mark Roberts
On Wed, 2008-07-16 at 07:39 +0200, A. Kretschmer wrote: > am Tue, dem 15.07.2008, um 18:15:07 -0700 mailte Mark Roberts > folgendes: > > > > On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote: > > > am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros > Cristina folgendes: > > > > How

Re: [SQL] Rollback in Postgres

2008-07-16 Thread Kaare Rasmussen
> No, they developed it for marketing. Perhaps, but towards whom? PostgreSQL wouldn't hurt if a lot of developers and DBA's was lured into the trap by this new feature. > Keep in mind that Oracle has six thousand full-time developers and an > already extremely mature database. Stuff that they s

Re: [SQL] Problem with ORDER BY and DISTINCT ON

2008-07-16 Thread Tom Lane
Steve Midgley <[EMAIL PROTECTED]> writes: > SELECT DISTINCT ON > ("property"."state", > CASE WHEN ("search_rate_max" IS NOT NULL) THEN 1 ELSE 2 > END,"search_rate_max", > CASE WHEN ("search_rate_max" IS NOT NULL) THEN 1 ELSE 2 > END,"search_rate_max", > property.id) > property.id > FROM p

[SQL] integrity check and visibility was: COPY equivalent for updates

2008-07-16 Thread Ivan Sergio Borgonovo
On Tue, 15 Jul 2008 22:13:42 -0500 Decibel! <[EMAIL PROTECTED]> wrote: > Depending on what you're doing, it might well be fastest to... > BEGIN; > COPY temp_table FROM 'file'; > DELETE FROM real_table WHERE real_table_id IN (SELECT > real_table_id FROM temp_table); > INSERT INTO real_table SELECT

[SQL] Problem with ORDER BY and DISTINCT ON

2008-07-16 Thread Steve Midgley
Hi, I'm a little baffled. I'm trying to generate a SQL statement that issues a DISTINCT ON using the same values as my ORDER BY statement. I'm using a somewhat complex CASE statement in my ORDER BY clause. I'm on Pg 8.2. Here is some SQL to get you started at seeing my problem: -