Lists: | pgsql-hackers |
---|
From: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | IntArray in c.h |
Date: | 2009-12-29 09:50:30 |
Message-ID: | e08cc0400912290150x67586acaq8ddf7e83b1e35ab0@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
I found the struct IntArray defined in c.h is actually used only in
execQual.c. ISTM the definition should be at least moved to the right
place.
Attached is a trivial fix. Addition to the explanation above, I
replaced IntArray by simple int array bounded with MAXDIM and remove
local variable lIndex in ExecEvalArrayRef because the usage of the
variable doesn't seem good to me.
Regression passed and various manual tests like "UPDATE t SET
a[1:2][1] = 1" didn't fail.
Regards,
--
Hitoshi Harada
Attachment | Content-Type | Size |
---|---|---|
IntArray.patch | application/octet-stream | 4.4 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2009-12-29 15:38:44 |
Message-ID: | 23657.1262101124@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> I found the struct IntArray defined in c.h is actually used only in
> execQual.c. ISTM the definition should be at least moved to the right
> place.
It's a general-purpose datatype that might be used anywhere that array
indexing happens. I think the fact that it's currently used only in
execQual is mere happenstance, and should not be "enforced" by moving
or removing the declaration.
regards, tom lane
From: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2009-12-30 02:46:40 |
Message-ID: | e08cc0400912291846l56f7ee5bo94ee1650cab51f55@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2009/12/30 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
>> I found the struct IntArray defined in c.h is actually used only in
>> execQual.c. ISTM the definition should be at least moved to the right
>> place.
>
> It's a general-purpose datatype that might be used anywhere that array
> indexing happens. I think the fact that it's currently used only in
> execQual is mere happenstance, and should not be "enforced" by moving
> or removing the declaration.
I would be convinced if the struct or the logic was complex, but
actually it is so simple that it can be replaced by primitive int
array. Also, it seems to me that c.h is too general place to declare
it for such purpose. Does nobody else think so?
Regards,
--
Hitoshi Harada
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2009-12-31 13:07:10 |
Message-ID: | 1262264830.31337.16.camel@fsopti579.F-Secure.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On ons, 2009-12-30 at 11:46 +0900, Hitoshi Harada wrote:
> 2009/12/30 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> > Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> >> I found the struct IntArray defined in c.h is actually used only in
> >> execQual.c. ISTM the definition should be at least moved to the right
> >> place.
> >
> > It's a general-purpose datatype that might be used anywhere that array
> > indexing happens. I think the fact that it's currently used only in
> > execQual is mere happenstance, and should not be "enforced" by moving
> > or removing the declaration.
>
> I would be convinced if the struct or the logic was complex, but
> actually it is so simple that it can be replaced by primitive int
> array. Also, it seems to me that c.h is too general place to declare
> it for such purpose. Does nobody else think so?
The definition of c.h is bogus anyway. You might think it contains
includes and defines to set up a portable C environment, which is what
the first half indeed does.
But then things like regproc, transaction ID types, IntArray, varlena,
bytea, oidvector, NameData, etc. do not belong there and should be moved
to postgres.h.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2009-12-31 16:28:02 |
Message-ID: | 439.1262276882@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The definition of c.h is bogus anyway. You might think it contains
> includes and defines to set up a portable C environment, which is what
> the first half indeed does.
> But then things like regproc, transaction ID types, IntArray, varlena,
> bytea, oidvector, NameData, etc. do not belong there and should be moved
> to postgres.h.
Actually, what c.h does is to provide definitions that are needed in
both frontend and backend code. And we do NOT want to start including
postgres.h in frontend code. It might be that some of the declarations
there are useless to frontend code and could be moved, but trying to be
as strict as you suggest is only going to create problems.
regards, tom lane
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2010-01-01 19:54:16 |
Message-ID: | 1262375656.29407.6.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On tor, 2009-12-31 at 11:28 -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > The definition of c.h is bogus anyway. You might think it contains
> > includes and defines to set up a portable C environment, which is what
> > the first half indeed does.
>
> > But then things like regproc, transaction ID types, IntArray, varlena,
> > bytea, oidvector, NameData, etc. do not belong there and should be moved
> > to postgres.h.
>
> Actually, what c.h does is to provide definitions that are needed in
> both frontend and backend code. And we do NOT want to start including
> postgres.h in frontend code. It might be that some of the declarations
> there are useless to frontend code and could be moved, but trying to be
> as strict as you suggest is only going to create problems.
I think the list above is a pretty good list of things that client code
doesn't need, plus or minus a few things maybe.
From: | Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: IntArray in c.h |
Date: | 2010-01-03 03:40:54 |
Message-ID: | e08cc0401001021940w7c71c2cnd26f01ebc75f80ab@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2010/1/2 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> On tor, 2009-12-31 at 11:28 -0500, Tom Lane wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> > The definition of c.h is bogus anyway. You might think it contains
>> > includes and defines to set up a portable C environment, which is what
>> > the first half indeed does.
>>
>> > But then things like regproc, transaction ID types, IntArray, varlena,
>> > bytea, oidvector, NameData, etc. do not belong there and should be moved
>> > to postgres.h.
>>
>> Actually, what c.h does is to provide definitions that are needed in
>> both frontend and backend code. And we do NOT want to start including
>> postgres.h in frontend code. It might be that some of the declarations
>> there are useless to frontend code and could be moved, but trying to be
>> as strict as you suggest is only going to create problems.
>
> I think the list above is a pretty good list of things that client code
> doesn't need, plus or minus a few things maybe.
>
Looking closer in c.h, there are several things to move or remove (and
it gets slightly more efficient if we do), but it seems we don't have
such motivation...
Regards,
--
Hitoshi Harada