Re: [PATCH] Cleanup of PLpgSQL_recfield

Lists: pgsql-hackers
From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-04 20:07:26
Message-ID: 36e682920811041207y474106f2y4c6b0beec8113b7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

While looking to add some functionality to PL/pgSQL, I found that the
rfno member of the PLpgSQL_recfield structure is unused. This patch
is just a cleanup and doesn't seem along the same lines as the patches
in CommitFest... should I add it to the wiki anyway?

--
Jonah H. Harris, Senior DBA
myYearbook.com

Attachment Content-Type Size
plpgsql_unused_recrfno.patch application/octet-stream 459 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Cc: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-04 20:57:52
Message-ID: 27613.1225832272@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Jonah H. Harris" <jonah(dot)harris(at)gmail(dot)com> writes:
> While looking to add some functionality to PL/pgSQL, I found that the
> rfno member of the PLpgSQL_recfield structure is unused. This patch
> is just a cleanup

No, that'd be wrong. Note here:

/*
* PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var,
* PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, PLpgSQL_arrayelem, and
* PLpgSQL_trigarg
*/
typedef struct
{ /* Generic datum array item */
int dtype;
int dno;
} PLpgSQL_datum;

I am not real sure why the code is inconsistent about spelling the
second field's name differently in some of the structs, but it seems
like a bad idea --- as you've demonstrated, it invites confusion.
What would probably be better is a patch to rename exprno, rfno, etc
to all be called dno to make this connection more obvious.

regards, tom lane


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-04 20:58:56
Message-ID: 20081104205856.GL3958@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jonah H. Harris escribió:
> While looking to add some functionality to PL/pgSQL, I found that the
> rfno member of the PLpgSQL_recfield structure is unused. This patch
> is just a cleanup and doesn't seem along the same lines as the patches
> in CommitFest... should I add it to the wiki anyway?

Nah -- I just applied it. Thanks.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-04 20:59:28
Message-ID: 20081104205928.GM3958@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane escribió:
> "Jonah H. Harris" <jonah(dot)harris(at)gmail(dot)com> writes:
> > While looking to add some functionality to PL/pgSQL, I found that the
> > rfno member of the PLpgSQL_recfield structure is unused. This patch
> > is just a cleanup
>
> No, that'd be wrong.

Oops. Reverting.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-04 23:17:40
Message-ID: 36e682920811041517lf3482cbmc06765a4877a1262@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Nov 4, 2008 at 3:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I am not real sure why the code is inconsistent about spelling the
> second field's name differently in some of the structs, but it seems
> like a bad idea --- as you've demonstrated, it invites confusion.
> What would probably be better is a patch to rename exprno, rfno, etc
> to all be called dno to make this connection more obvious.

Attached. Passed regressions and basic testing.

--
Jonah H. Harris, Senior DBA
myYearbook.com

Attachment Content-Type Size
plpgsql_datumnaming_cleanup.patch application/octet-stream 16.4 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Cc: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup of PLpgSQL_recfield
Date: 2008-11-05 00:08:28
Message-ID: 1050.1225843708@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Jonah H. Harris" <jonah(dot)harris(at)gmail(dot)com> writes:
> On Tue, Nov 4, 2008 at 3:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I am not real sure why the code is inconsistent about spelling the
>> second field's name differently in some of the structs, but it seems
>> like a bad idea --- as you've demonstrated, it invites confusion.
>> What would probably be better is a patch to rename exprno, rfno, etc
>> to all be called dno to make this connection more obvious.

> Attached. Passed regressions and basic testing.

Looks good, applied.

regards, tom lane