Re: Limit usage of tcop/dest.h

Lists: pgsql-hackerspgsql-patches
From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Debug in dest.h
Date: 2005-11-01 17:40:20
Message-ID: 20051101174020.GA20575@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hackers,

The "Debug" destreceiver has a pretty bad name. In fact for PL/php it
collides with a PHP symbol. Does anyone mind if I rename it to, say,
DestDebug?

--
Alvaro Herrera http://www.advogato.org/person/alvherre
"El sabio habla porque tiene algo que decir;
el tonto, porque tiene que decir algo" (Platon).


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debug in dest.h
Date: 2005-11-01 18:14:39
Message-ID: 26822.1130868879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> The "Debug" destreceiver has a pretty bad name. In fact for PL/php it
> collides with a PHP symbol. Does anyone mind if I rename it to, say,
> DestDebug?

If you do that, you should rename all the values of the enum
(DestNone, etc). For consistency, and because the same charge
could be leveled at None and Remote.

regards, tom lane


From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 13:22:19
Message-ID: 4225.24.211.165.134.1130937739.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera said:
> Hi,
>
> (It also allows PL/php to compile without having to patch
> PHP nor PostgreSQL sources).
>

That will make some people I know happy ;-)

cheers

andrew


From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Limit usage of tcop/dest.h
Date: 2005-11-02 13:50:07
Message-ID: 20051102135007.GC26524@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi,

I just found out that tcop/dest.h is included in executor/spi.h, and it
contains many things that aren't needed for compiling SPI programs/
libraries. By way of example I compiled the whole of contrib with the
attached patch and it works fine. Notice that the only thing I'm doing
is taking the forward declaration of Portal into a separate file,
portalforw.h -- that's the only definition that's really needed by SPI
programs. (It also allows PL/php to compile without having to patch PHP
nor PostgreSQL sources).

Note that since tcop/dest.h now includes portalforw.h, anybody who
currently needs the Portal definition is still getting it. The only
thing I'm doing is un-export the rest of tcop/dest.h from
executor/spi.h.

So instead of changing the names of the CommandDest enum, I'm hiding it
from external view.

Note that executor/spi.h does not follow the convention that #includes
should be alphabetically ordered. I did not change that in this patch
in order to show that this change is really minimal.

Does anybody object to committing this patch to current CVS HEAD?
(Comments about a better position/name for the new file are welcome.)

--
Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34J
"The only difference is that Saddam would kill you on private, where the
Americans will kill you in public" (Mohammad Saleh, 39, a building contractor)

Attachment Content-Type Size
portalforw.h text/x-chdr 354 bytes

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 14:11:04
Message-ID: 20051102141104.GG26524@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan wrote:
> Alvaro Herrera said:
> > Hi,
> >
> > (It also allows PL/php to compile without having to patch
> > PHP nor PostgreSQL sources).
>
> That will make some people I know happy ;-)

Yeah -- the current PL/php build system is a crock (not sure what that
is, but it sounds nice and it appears on Pg sources) :-) so I'm
currently modifying it to work using PGXS. They won't need Pg sources
at all really (and conversely, only PHP headers and the shared lib, not
the whole sources).

--
Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4
"La realidad se compone de muchos sueños, todos ellos diferentes,
pero en cierto aspecto, parecidos..." (Yo, hablando de sueños eróticos)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 14:20:15
Message-ID: 5150.1130941215@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> So instead of changing the names of the CommandDest enum, I'm hiding it
> from external view.

I thought renaming them was a better idea, actually. A whole separate
include file to have one forward typedef seems pretty silly. Nor am I
convinced that you won't break some people's code by removing the rest
of dest.h from spi.h. Finally, for anyone who *does* need to include
dest.h, this doesn't address the underlying problem of risk of conflict
of names.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 15:22:20
Message-ID: 200511021522.jA2FMKQ17622@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > So instead of changing the names of the CommandDest enum, I'm hiding it
> > from external view.
>
> I thought renaming them was a better idea, actually. A whole separate
> include file to have one forward typedef seems pretty silly. Nor am I
> convinced that you won't break some people's code by removing the rest
> of dest.h from spi.h. Finally, for anyone who *does* need to include
> dest.h, this doesn't address the underlying problem of risk of conflict
> of names.

Does the change make building PL/PHP easier?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 15:43:03
Message-ID: 20051102154303.GA29496@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > > So instead of changing the names of the CommandDest enum, I'm hiding it
> > > from external view.
> >
> > I thought renaming them was a better idea, actually. A whole separate
> > include file to have one forward typedef seems pretty silly. Nor am I
> > convinced that you won't break some people's code by removing the rest
> > of dest.h from spi.h. Finally, for anyone who *does* need to include
> > dest.h, this doesn't address the underlying problem of risk of conflict
> > of names.
>
> Does the change make building PL/PHP easier?

Yes, the point of these changes is to make PL/php much easier. Either
one will do -- renaming the enum elements is what I'm doing now, so we
don't have to change include file.

(Mind you, I still believe that that particular declaration does not
belong in that file, but that's a different discussion.)

(We will still need some hack in order to build PL/php against 8.0, but
that's another problem.)

--
Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34J
"Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)


From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 16:02:16
Message-ID: 20051102160216.GC29496@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

> I thought renaming them was a better idea, actually.

Here is a patch for that. I will apply this to HEAD later today.

--
Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 17.7", W 73º 14' 26.8"
"The eagle never lost so much time, as
when he submitted to learn of the crow." (William Blake)

Attachment Content-Type Size
dest-rename.patch text/plain 31.8 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Limit usage of tcop/dest.h
Date: 2005-11-02 16:15:58
Message-ID: 6201.1130948158@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> Tom Lane wrote:
>> I thought renaming them was a better idea, actually.

> Here is a patch for that. I will apply this to HEAD later today.

Looks ok in a quick eyeball pass.

regards, tom lane