pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Ruediger Herrmann <ruediger.herrmann@gmx.de>
To: pgsql-sql@postgresql.org
Subject: Dynamic PL/pgSQL
Date: Thu, 16 Jun 2005 00:10:56 +0200 (MEST)
Message-ID: <7884.1118873456@www67.gmx.net> (raw)
I plan to run an SQL script - using JDBC - to initialize a database.
Right now I have the need to execute serveral statements only under
certain conditions.
for example:
IF NOT EXISTS (
SELECT 1 FROM pg_catalog.pg_user WHERE ussername = 'Jon' ) THEN
CREATE USER 'Jon';
END IF;
Within a PL/pgSQL function this would be easy, but I need to store the
complete initialization script in a text file and execute it as a whole.
Is there any way to solve this? Any suggestions are welcome
TIA
RĂ¼diger
--
Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis
++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++
view thread (2+ messages) latest in thread
Message-ID: <7884.1118873456@www67.gmx.net> Permalink: ../7884.1118873456@www67.gmx.net/ Also on: postgresql.org/message-id/7884.1118873456@www67.gmx.net ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: ruediger.herrmann@gmx.de Subject: Re: Dynamic PL/pgSQL In-Reply-To: <7884.1118873456@www67.gmx.net> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
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