Re: function to operate on same fields, different records?
| От | Tom Lane |
|---|---|
| Тема | Re: function to operate on same fields, different records? |
| Дата | |
| Msg-id | 7669.986221294@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: function to operate on same fields, different records? (will trillich <will@serensoft.com>) |
| Ответы |
Re: function to operate on same fields, different records?
|
| Список | pgsql-general |
will trillich <will@serensoft.com> writes:
> i've tried
> create function gpa(OPAQUE) ....
> and psql tells me it successfully
> CREATED
> something, but
> \df
> shows no such function.
I believe \df suppresses opaque-argument functions, on the theory that
they're probably just I/O functions. But OPAQUE won't do you any good
anyway unless you code the function in C.
> what arg to i specify to allow varying records (with a subset of
> exactly-the-same-names field subset) to be passed to a function?
Inheritance seems to work for this in current sources:
regression=# create table p1 (f1 int);
CREATE
regression=# create table p2 (f2 int) inherits (p1);
CREATE
regression=# create function getf1(p1) returns int as '
regression'# select $1.f1' language 'sql';
CREATE
regression=# insert into p1 values(1);
INSERT 1030276 1
regression=# insert into p2 values(11,22);
INSERT 1030277 1
regression=# select getf1(p1) from p1;
getf1
-------
1
11
(2 rows)
regression=#
regards, tom lane
В списке pgsql-general по дате отправления: