Re: [HACKERS] UPSERT on partition

2015-06-29 Thread Amit Langote
On 2015-06-25 AM 09:51, Amit Langote wrote: > > Peter, > > On 2015-06-25 AM 02:35, Peter Geoghegan wrote: >> >> Inheritance with triggers is a leaky abstraction, so this kind of >> thing is always awkward. Still, UPSERT has full support for >> *inheritance* -- that just doesn't help in this case.

Re: [HACKERS] UPSERT on partition

2015-06-26 Thread Simon Riggs
On 24 June 2015 at 15:05, Fujii Masao wrote: > How should we treat this problem for 9.5? If we want to fix this problem > completely, probably we would need to make constraint_exclusion work with > even UPSERT. Which sounds difficult to do at least for 9.5. Any other idea? > Or we should just tr

Re: [HACKERS] UPSERT on partition

2015-06-26 Thread Jim Nasby
On 6/24/15 1:03 PM, Peter Geoghegan wrote: On Wed, Jun 24, 2015 at 11:02 AM, Peter Geoghegan wrote: I think that the real way to fix this is, as you say, to make it so that it isn't necessary in general to write trigger functions like this to make inheritance work. Excuse me -- I mean to make

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Amit Langote
Peter, On 2015-06-25 AM 02:35, Peter Geoghegan wrote: > > Inheritance with triggers is a leaky abstraction, so this kind of > thing is always awkward. Still, UPSERT has full support for > *inheritance* -- that just doesn't help in this case. > Could you clarify as to what UPSERT's support for

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Peter Geoghegan
On Wed, Jun 24, 2015 at 11:02 AM, Peter Geoghegan wrote: > I think that the real way to fix this is, as you say, to make it so > that it isn't necessary in general to write trigger functions like > this to make inheritance work. Excuse me -- I mean to make *partitioning* work. -- Peter Geoghega

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Peter Geoghegan
On Wed, Jun 24, 2015 at 7:05 AM, Fujii Masao wrote: > How should we treat this problem for 9.5? If we want to fix this problem > completely, probably we would need to make constraint_exclusion work with > even UPSERT. Which sounds difficult to do at least for 9.5. Any other idea? > Or we should ju

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Peter Geoghegan
On Wed, Jun 24, 2015 at 7:38 AM, Robert Haas wrote: > Is the root of the problem that the trigger is called for an INSERT .. > ON CONFLICT statement but it turns that into a plain INSERT? > > Is there any way of writing a partitioning trigger that doesn't have > that defect? We did discuss whethe

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Andres Freund
On 2015-06-24 10:38:38 -0400, Robert Haas wrote: > On Wed, Jun 24, 2015 at 10:29 AM, Andres Freund wrote: > > On 2015-06-24 23:05:45 +0900, Fujii Masao wrote: > >> INSERT ON CONFLICT DO UPDATE doesn't seem to work on the current > >> partitioning > >> mechanism. For example, in the following SQL

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Robert Haas
On Wed, Jun 24, 2015 at 10:29 AM, Andres Freund wrote: > On 2015-06-24 23:05:45 +0900, Fujii Masao wrote: >> INSERT ON CONFLICT DO UPDATE doesn't seem to work on the current partitioning >> mechanism. For example, in the following SQL commands, the last UPSERT >> command >> would fail with an err

Re: [HACKERS] UPSERT on partition

2015-06-24 Thread Andres Freund
Hi, On 2015-06-24 23:05:45 +0900, Fujii Masao wrote: > INSERT ON CONFLICT DO UPDATE doesn't seem to work on the current partitioning > mechanism. For example, in the following SQL commands, the last UPSERT command > would fail with an error. The error message is I think that's pretty much inevita

[HACKERS] UPSERT on partition

2015-06-24 Thread Fujii Masao
Hi, INSERT ON CONFLICT DO UPDATE doesn't seem to work on the current partitioning mechanism. For example, in the following SQL commands, the last UPSERT command would fail with an error. The error message is ERROR: duplicate key value violates unique constraint "hoge_20150601_pkey" DETAI