can we enhance regtype infunction to support %type and %type[]

Lists: pgsql-hackers
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: can we enhance regtype infunction to support %type and %type[]
Date: 2010-09-04 05:30:09
Message-ID: AANLkTim+1CE+qLsz=55n5nO6aDc9GQdsX+u5ij0_PUB0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello

I am looking on ToDo topic - Allow handling of %TYPE arrays, e.g.
tab.col%TYPE[]

Some the most simple solution can be enhancing regtype to support this
syntax - this can be relative simple, and it can be useful for other
PL and for dynamic SQL too. It can be simple test - if some table has
a column or not.

comments?

Regards

Pavel Stehule


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: can we enhance regtype infunction to support %type and %type[]
Date: 2010-09-04 16:12:02
Message-ID: 16581.1283616722@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> I am looking on ToDo topic - Allow handling of %TYPE arrays, e.g.
> tab.col%TYPE[]

> Some the most simple solution can be enhancing regtype to support this
> syntax

I'm not really in favor of adding a wart like that to regtype, and
I don't see how it would do anything to advance the TODO item anyway.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: can we enhance regtype infunction to support %type and %type[]
Date: 2010-09-04 16:52:51
Message-ID: AANLkTi=sHkNaH7_tnc_qfcc8qc732JLjA9Ez_-MZAHNm@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/9/4 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> I am looking on ToDo topic - Allow handling of %TYPE arrays, e.g.
>> tab.col%TYPE[]
>
>> Some the most simple solution can be enhancing regtype to support this
>> syntax
>
> I'm not really in favor of adding a wart like that to regtype, and
> I don't see how it would do anything to advance the TODO item anyway.

it can reduce a duplicate code - it is used on PL level and on PLpgSQL.

and be very useful as protection to SQL injection, where you have to
check if some table has some column.

Regards

Pavel Stehule

>
>                        regards, tom lane
>