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

Started by Pavel Stehuleover 15 years ago3 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: can we enhance regtype infunction to support %type and %type[]

Pavel Stehule <pavel.stehule@gmail.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

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#2)
Re: can we enhance regtype infunction to support %type and %type[]

2010/9/4 Tom Lane <tgl@sss.pgh.pa.us>:

Pavel Stehule <pavel.stehule@gmail.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

Show quoted text

                       regards, tom lane