pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Function Inheritance?
3+ messages / 2 participants
[nested] [flat]

* Function Inheritance?
@ 2001-04-10 03:43  Mark Butler <butlerm@middle.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Mark Butler @ 2001-04-10 03:43 UTC (permalink / raw)
  To: pgsql-docs

In http://www.postgresql.org/devel-corner/docs/postgres/sql-createtable.html

"Postgres automatically allows the created table to inherit functions on
tables above it in the inheritance hierarchy."

"Postgres automatically allows the created table to inherit functions on
tables above it in the inheritance hierarchy. Inheritance of functions is done
according to the conventions of the Common Lisp Object System (CLOS)."

Neither of these statements is true, right?  I do not beleive that PostgreSQL
current supports inheritable member functions.  Shouldn't both of these
statements be removed?

- Mark Butler



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Function Inheritance?
@ 2001-04-13 16:56  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Mark Butler <butlerm@middle.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2001-04-13 16:56 UTC (permalink / raw)
  To: Mark Butler <butlerm@middle.net>; +Cc: pgsql-docs

Mark Butler <butlerm@middle.net> writes:
> In http://www.postgresql.org/devel-corner/docs/postgres/sql-createtable.html
> "Postgres automatically allows the created table to inherit functions on
> tables above it in the inheritance hierarchy."

> "Postgres automatically allows the created table to inherit functions on
> tables above it in the inheritance hierarchy. Inheritance of functions is done
> according to the conventions of the Common Lisp Object System (CLOS)."

> Neither of these statements is true, right?

It still works.

regression=# create table foo (f1 int);
CREATE
regression=# create function getf1(foo) returns int as 'select $1.f1'
regression-# language 'sql';
CREATE
regression=# insert into foo values (42);
INSERT 149940 1
regression=# select getf1(foo) from foo;
 getf1
-------
    42
(1 row)

regression=# create table foot (g1 int) inherits (foo);
CREATE
regression=# insert into foot values (22,33);
INSERT 149954 1
regression=# select getf1(foot) from foot;
 getf1
-------
    22
(1 row)


We may have to break this at some point in pursuit of SQL-mandated
features, but it's not dead yet ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Function Inheritance?
@ 2001-04-13 17:35  Mark Butler <butlerm@middle.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Mark Butler @ 2001-04-13 17:35 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs

[Re: Tom Lane's explanation of function inheritance]

That is a really nice capability.  However, the statement is somewhat
confusing because this is a matter of parameter type promotion rather than
member/method function inheritance, which is what I thought was being referred
to.

I suggest something like the following:

"In Postgres, each created table automatically defines a new row object type
in an inheritance hierarchy.  Postgres automatically allows a descendant table
row object to be used anywhere a parent table row object is called for.  This
means that functions declared to accept row objects from a parent table
automatically accept row objects from all of its descendant tables as well."

Is that an improvement?  I believe the SQL3 people were wrestling with similar
nomenclature issues once upon a time...

 - Mark Butler



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-04-13 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-10 03:43 Function Inheritance? Mark Butler <butlerm@middle.net>
2001-04-13 16:56 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-04-13 17:35   ` Mark Butler <butlerm@middle.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox