Re: AW: functions returning records - Mailing list pgsql-hackers

From Alex Pilosov
Subject Re: AW: functions returning records
Date
Msg-id Pine.BSO.4.10.10106270837190.20546-100000@spider.pilosoft.com
Whole thread Raw
In response to Re: AW: functions returning records  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: AW: functions returning records
List 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)?
ew.

>  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? 
\df

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...

-alex



pgsql-hackers by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: AW: functions returning records
Next
From: Hannu Krosing
Date:
Subject: Re: Re: 7.2 items