pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Abort Transaction DP PK (again)
4+ messages / 3 participants
[nested] [flat]

* Abort Transaction DP PK (again)
@ 2003-08-07 17:04  alexandre :: aldeia digital <alexandre@aldeiadigital.com.br>
  0 siblings, 1 reply; 4+ messages in thread

From: alexandre :: aldeia digital @ 2003-08-07 17:04 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I know that this topic was discuted before but I like an alternative for
my high load INSERT query.
Why Postgres abort a transaction when find a duplicate PK ?!?!

A simple Fuction test:

(...)
  SELECT a,b from foo where a=1 and b=1
  IF NOT FOUND
    INSERT INTO foo VALUES(1,1)
  ELSE
    UPDATE
(...)

Is, obviously, very very much slower than this (hipotetic) function:

(...)
  INSERT INTO foo
  IF "ERROR DP PK"
    UPDATE
(...)

In both cases, INSERT will test if values violate the PK... but in first
example the extra SELECT cause an unnecessary extreame work...

Thanks,

Alexandre




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Abort Transaction DP PK (again)
@ 2003-08-08 16:37  Josh Berkus <josh@agliodbs.com>
  parent: alexandre :: aldeia digital <alexandre@aldeiadigital.com.br>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2003-08-08 16:37 UTC (permalink / raw)
  To: alexandre :: aldeia digital <alexandre@aldeiadigital.com.br>; pgsql-sql

Alexandre,

> I know that this topic was discuted before but I like an alternative for
> my high load INSERT query.
> Why Postgres abort a transaction when find a duplicate PK ?!?!

Postgres currently aborts a transaction upon *any* error condition, except 
warnings.  We do not, currently, have a exception-handling model for 
procedure code.  It's on the TODO list.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Abort Transaction DP PK (again)
@ 2003-08-08 20:22  alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: alexandre :: aldeia digital @ 2003-08-08 20:22 UTC (permalink / raw)
  To: pgsql-sql

Josh,

It´s very difficult to change the behaviour of a duplicate PK, from
"error" to "warning"?

It´s possible, in a future release, to have an exception-handling for all
client interfaces, like ODBC or JDBC?

Thanks,

Alexandre

> Alexandre,
>
>> I know that this topic was discuted before but I like an alternative for
>> my high load INSERT query.
>> Why Postgres abort a transaction when find a duplicate PK ?!?!
>
> Postgres currently aborts a transaction upon *any* error condition, except
> warnings.  We do not, currently, have a exception-handling model for
> procedure code.  It's on the TODO list.
>
> --
> Josh Berkus
> Aglio Database Solutions
> San Francisco
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Abort Transaction DP PK (again)
@ 2003-08-08 21:45  Josh Berkus <josh@agliodbs.com>
  parent: alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
  0 siblings, 0 replies; 4+ messages in thread

From: Josh Berkus @ 2003-08-08 21:45 UTC (permalink / raw)
  To: alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>; pgsql-sql

Alexandre,

> It´s very difficult to change the behaviour of a duplicate PK, from
> "error" to "warning"?

That would be a very bad idea because then the duplicate row would be inserted 
anyway.   And you'd have to hack the source code.

> It´s possible, in a future release, to have an exception-handling for all
> client interfaces, like ODBC or JDBC?

I'm not quite sure what you mean.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-08-08 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 17:04 Abort Transaction DP PK (again) alexandre :: aldeia digital <alexandre@aldeiadigital.com.br>
2003-08-08 16:37 ` Josh Berkus <josh@agliodbs.com>
2003-08-08 20:22   ` alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
2003-08-08 21:45     ` Josh Berkus <josh@agliodbs.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox