Re: MERGE Specification - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: MERGE Specification
Date
Msg-id 4C61623E.2050709@enterprisedb.com
Whole thread Raw
In response to Re: MERGE Specification  (Boxuan Zhai <bxzhai2010@gmail.com>)
Responses Re: MERGE Specification
List pgsql-hackers
On 10/08/10 12:08, Boxuan Zhai wrote:
> Thanks for your feedback. I fixed all the above waring bugs. Find the new
> patch in attachement.

Thanks.

I'm getting an assertion failure with this statement:

CREATE TABLE foo (id int4);

MERGE into foo t
USING (select id FROM generate_series(1,5) id) AS s
ON t.id = s.id
WHEN NOT MATCHED THEN INSERT (id) VALUES (s.id);

TRAP: FailedAssertion("!(ActiveSnapshotSet())", File: "postgres.c", 
Line: 749)

That's easily fixed - you need to add "case T_MergeStmt" to the list of 
optimizable command types in analyze_requires_snapshot() function.

Unfortunately that doesn't get you far, the query then trips another 
assertion:

TRAP: FailedAssertion("!(list_length(resultRelations) == 
list_length(subplans))", File: "createplan.c", Line: 3929)

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: trace_recovery_messages
Next
From: Peter Eisentraut
Date:
Subject: Re: host name support in pg_hba.conf