Re: merge command - GSoC progress

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Boxuan Zhai <bxzhai2010(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: merge command - GSoC progress
Date: 2010-07-28 10:28:32
Message-ID: AANLkTim2bk+-1M3mE+axD7Samw4nydoBDusQx-0BRHkD@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 28, 2010 at 6:08 AM, Boxuan Zhai <bxzhai2010(at)gmail(dot)com> wrote:
>> On Tue, Jul 27, 2010 at 1:04 AM, Boxuan Zhai <bxzhai2010(at)gmail(dot)com> wrote:
>> > I have get a edition that the merge command can run. It accept the
>> > standard
>> > merge command and can do UPDATE, INSERT and DELETE actions now. But we
>> > cannot put additional qualification for actions. There are some bugs
>> > when we
>> > try to evaluate the quals which make the system quit. I will fix it
>> > soon.
>>
>> This patch doesn't compile.  You're using zbxprint() from a bunch of
>> places where it's not defined.  I get compile warnings for all of
>> those files and then a link failure at the end.  You might find it
>> useful to create src/Makefile.custom in your local tree and put
>> COPT=-Werror in there; it tends to prevent problems of this kind.
>>
>> Undefined symbols:
>>  "_zbxprint", referenced from:
>>      _transformStmt in analyze.o
>>      _ExecInitMergeAction in nodeModifyTable.o
>>      _ExecModifyTable in nodeModifyTable.o
>>      _ExecInitModifyTable in nodeModifyTable.o
>>      _merge_action_planner in planner.o
>>
> Sorry, this is a debug function defined by me. It may not be included in the
> patch. I add a line of "#define zbxprint printf" somewhere in the system.

Yeah, but it's not included in all the places that are needed to make
everything compile. You might move this to postgres.h or something.

>> Not that it's as high-priority as getting this fully working, but you
>> should revert the useless changes in this patch - e.g. the one-line
>> change to heaptuple.c is obvious debugging leftovers, and all of the
>> changes to execQual.c and execUtil.c are whitespace-only.  You should
>> also try to make your code and comments conform to project style
>> guidelines.  In general, you'll find it easier to keep track of your
>> changes (and you'll have fewer spurious changes) if you use git diff
>> master...yourbranch instead of marking comments, etc. with ZBX or
>> similar.
>
> I will clean all these in my next patch.
>
> I am now very confused with the failure of action qualification. I look
> through the whole process of a query, from parser to executor. In my
> opinion, the qualification transformed in analyzer, will be processed by
> prepsocess_qual_condition() in planner, and then by the ExecInitExpr()
> function in excutor start phase (in InitPlan() function). Then the qual is
> ready to be used in ExecQual(). Am I correct?

I'm not sure, sorry.

> I have done these on the merge action qual, but when I pass them into
> ExecQual(), the server just closed abnormally. I don't know if I missed any
> steps on preparing  the qual expressions.

Have you tried attaching a debugger? Try "SELECT pg_backend_pid()"
and then use "gdb -p the_pid" from another window. Hit "continue".
Then do whatever it is that's crashing. That way you can get a stack
backtrace, and poke around at the data structures.

Using pprint() on node-type data structures, either in debugging code
or actually straight from the debugger via "call", is also very
helpful, often-times.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Cave-Ayland 2010-07-28 10:29:28 Re: PostGIS vs. PGXS in 9.0beta3
Previous Message Boxuan Zhai 2010-07-28 10:08:48 Re: merge command - GSoC progress