[Dbconfig-common-devel] Re: createlang in a postgres database
Ruediger Beck
jeffbeck at web.de
Thu Sep 22 16:51:12 UTC 2005
Hi all,
sorry, this is the follow up to "createlang in a postgres database" from
th day before. Sean answered faster than i could confirm my adding to
this mailing list.
I have the following code from a dump to create the database of my
application:
--
-- PostgreSQL database dump
--
SET client_encoding = 'LATIN9';
SET check_function_bodies = false;
SET search_path = public, pg_catalog;
--
-- TOC entry 57 (OID 17643)
-- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema:
public; Owner: postgres
--
--***
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
AS '$libdir/plpgsql', 'plpgsql_call_handler'
LANGUAGE c;
--
-- TOC entry 56 (OID 17644)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner:
--
--***
CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
--
-- TOC entry 4 (OID 2200)
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
--***
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- TOC entry 5 (OID 17647)
-- Name: groups; Type: TABLE; Schema: public; Owner: ldap
--
CREATE TABLE groups (
id serial NOT NULL,
gidnumber integer NOT NULL,
gid character varying NOT NULL
);
...
CREATE FUNCTION create_groups() RETURNS integer
AS 'SELECT setval (''groups_id_seq'', (select max(id) FROM groups));
INSERT INTO groups (id,gid,gidnumber) VALUES
(nextval(''groups_id_seq''),'''',00);
INSERT INTO samba_group_mapping (id,gidnumber) VALUES ((SELECT max(id)
FROM groups),00);
SELECT max(id) FROM groups
'
LANGUAGE sql;
and so on ...
I put some code into the install-dbadmin directory (all lines preceeded
with --***) in the code above.
All other code (SET and CREATE staements) is in the install directory
the installation-process ist interrupted with the error:
... Language plpgsql nonexistent, HINT use createlang, ...
When I put the whole dump in the install-dbadmin directory, the database
is installed correctly.
Even the owner of the database is correct (the name specified with
dbc_dbuser)
My questions are:
Is it meant to put all sql-commands into install-dbadmin, when using a
database with a language?
In what order are the scripts in install, install-dbadmin, scrits executed?
Rüdiger Beck
More information about the Dbconfig-common-devel
mailing list