pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
procedural languages and public schema
2+ messages / 2 participants
[nested] [flat]

* procedural languages and public schema
@ 2005-07-13 12:16 Francesco Dalla Ca' <f.dallaca@cineca.it>
  2005-07-13 14:20 ` Re: procedural languages and public schema Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Francesco Dalla Ca' @ 2005-07-13 12:16 UTC (permalink / raw)
  To: pgsql-admin

What are the implications between the use of a pl language and the 
public schema?

When i use createlang on a database without  the public schema (dropped 
for safety reason),  createlang fail with the sequent error

...
postgres@pc-dba:~> createlang -d prova2 plpgsql --echo
SELECT oid FROM pg_language WHERE lanname = 'plpgsql';
SELECT oid FROM pg_proc WHERE proname = 'plpgsql_call_handler' AND 
prorettype = 'pg_catalog.language_handler'::regtype AND pronargs = 0;
SELECT oid FROM pg_proc WHERE proname = 'plpgsql_validator' AND 
proargtypes[0] = 'pg_catalog.oid'::regtype AND pronargs = 1;
CREATE FUNCTION "plpgsql_call_handler" () RETURNS language_handler AS 
'$libdir/plpgsql' LANGUAGE C;
CREATE FUNCTION "plpgsql_validator" (oid) RETURNS void AS 
'$libdir/plpgsql' LANGUAGE C;
CREATE TRUSTED LANGUAGE "plpgsql" HANDLER "plpgsql_call_handler" 
VALIDATOR "plpgsql_validator";
createlang: language installation failed: ERROR:  no schema has been 
selected to create in
postgres@pc-dba:~>
...

If i recreate the public schema (as default) the createlang perform 
without error.

The client 'createlang' attempt to create 2 functions on the public schema:
plxxx_call_handler
plxxx_validator

these function have got respectively null acl list, from pg_proc:

prova2=# select pg_proc.oid, proname, nspname, proacl from pg_proc, 
pg_namespace where pg_namespace.nspname='public' and 
pg_namespace.oid=pronamespace;
  oid   |       proname        | nspname | proacl
--------+----------------------+---------+--------
 571455 | plpgsql_call_handler | public  |
 571456 | plpgsql_validator    | public  |
(2 rows)

prova2=#

Can i create languages functions on a different schema?
This schema must be accessible for all db user?  With which privileges 
(only usage)?
What's the mean of the proacl column for these functions relatively to 
TRUSTED|UNTRUSTED create language clause?

===========================================

	 CINECA  Via Magnanelli 6/3
    40033 Casalecchio di Reno (Bologna)

	  Settore Gestione Sistemi

            Francesco Dalla Ca'
        Email  f.dallaca@cineca.it
===========================================




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

* Re: procedural languages and public schema
  2005-07-13 12:16 procedural languages and public schema Francesco Dalla Ca' <f.dallaca@cineca.it>
@ 2005-07-13 14:20 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2005-07-13 14:20 UTC (permalink / raw)
  To: Francesco Dalla Ca' <f.dallaca@cineca.it>; +Cc: pgsql-admin

"Francesco Dalla Ca'" <f.dallaca@cineca.it> writes:
> Can i create languages functions on a different schema?

You can, but you'd have to modify the createlang program, or do it by
hand using CREATE FUNCTION and CREATE LANGUAGE.  This is just a
restriction of createlang, not any fundamental limitation.

IIRC, we just changed things for 8.1 and up so that the functions are
created in pg_catalog instead of public.

			regards, tom lane



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


end of thread, other threads:[~2005-07-13 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-13 12:16 procedural languages and public schema Francesco Dalla Ca' <f.dallaca@cineca.it>
2005-07-13 14:20 ` Tom Lane <tgl@sss.pgh.pa.us>

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