Skip site navigation (1) Skip section navigation (2)

Re: AW: functions returning records

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: AW: functions returning records
Date: 2001-06-27 12:42:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Wed, 27 Jun 2001, Karel Zak wrote:

>  Sure, nobody wants to works with something other than is in the 
> pg_type.
> > problem with your idea is question if you have two functions (for example)
> > foo(timestamp) and foo(int4), you must embed the types into relname, and
> > that's ugly.
>  Good point. First, you needn't work with types, bacause function oid 
> is unique for foo(timestamp) and foo(int4). You can work with function
> oid. But this is not important. 
That's not nice. GRANT ALL ON FOO_231234 where 231234 is OID of foo(int4)?

>  The important thing is that in the PostgreSQL is already resolved very 
> simular problem. We can define function with same names, unique must
> be function_name + arguments_types. Why not add same thing for tables and 
> allows to define as unique table_name + table_type (where table_type
> is 'standard table', 'foo() table' and in future may be some other 
> special type of table). 
>  The parser detect type of table very easy -- 'foo' vs. 'foo()'. 
This is a little bit better, but, results in following syntax:
GRANT SELECT ON FOO(int4). I'm not sure if this really makes sense. Its
not a select permission, its an execute permission on a function, and
should be handled when/where execute permission is checked.

Its not hard to implement (just change what parser thinks relation is),
but I'm sure will conflict with _something_.

>  IMHO very important is how add new feature and use it together with
> old feature.
> > Once its possible to control permission to execute a function via GRANT,
> > it solves the grant problem for function-as-tablesource
>  The permissions system was an example only. If you add "foo()-tables"
> as something what needs special usage and care you probably found more
> problems. For example, what show command '\d' in the psql client, how
> relation show pg_access ..etc? 

Its a function, not a relation. You can do a lot of things to a relation
(such as define rules, triggers, constraints), which do not make any sense
for a function. The function may be used as a table-source, but it does
not make it a table. 

If you can give me a better example than permissions system, I'll surely
reconsider, but currently, I see no use for it...


In response to


pgsql-hackers by date

Next:From: Hannu KrosingDate: 2001-06-27 12:43:33
Subject: Re: Re: 7.2 items
Previous:From: Alex PilosovDate: 2001-06-27 12:30:42
Subject: Re: AW: functions returning records

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group