Re: MERGE Specification

From: Boxuan Zhai <bxzhai2010(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MERGE Specification
Date: 2010-08-11 04:09:11
Message-ID: AANLkTi=y0+FYJg3Sxuhzf1+27pQFYykBg4KSeU0A0_NJ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 10, 2010 at 10:29 PM, Heikki Linnakangas <
heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:

> 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);
>
> The query works on my machine.

> 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)
>
>
>
I just found that no Assert() works in my codes. I think it is because the
assertion is no enabled. How to enable assertion. To define
USE_ASSERT_CHECKING somewhere?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2010-08-11 04:14:44 Re: MERGE Specification
Previous Message Tom Lane 2010-08-11 03:58:12 Re: review: psql: edit function, show function commands patch