From: John DeSoi <desoi@pgedit.com>
To: Daniel CAUNE <d.caune@free.fr>
Cc: 'pgsql-sql@postgresql.org' SQL <pgsql-sql@postgresql.org>
Subject: Re: Executing plpgsql scripts using psql, is that possible?
Date: Mon, 16 Jan 2006 21:54:55 -0500
Message-ID: <F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com> (raw)
In-Reply-To: <0IT700IG8S07GF90@VL-MO-MR002.ip.videotron.ca>
References: <0IT700IG8S07GF90@VL-MO-MR002.ip.videotron.ca>
Daniel,
On Jan 16, 2006, at 8:55 PM, Daniel CAUNE wrote:
> Yes, but that requires creating a function while I would prefer not
> having do so, as I said in my previous mail: "I mean, without
> creating a function that wraps the whole, of course! :-)". Why?
> Actually this is not a function; this is a script that inserts
> static data into dimension tables such as Country, Language, etc.
Sorry I misunderstood the question.
> So, I completely understand that I can write an SQL script that:
>
> 1 - creates a function that wraps SQL code that inserts static
> data into dimension tables.
> 2 - executes that function
> 3 - destroys that function
>
> But actually that is a bit weird, isn't it?
\copy is the easiest way in psql to populate tables.
If you need more control, maybe copy the data to temp tables and then
write plpgsql as needed to insert the data into the final tables.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: desoi@pgedit.com, d.caune@free.fr
Subject: Re: Executing plpgsql scripts using psql, is that possible?
In-Reply-To: <F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com>
References: <0IT700IG8S07GF90@VL-MO-MR002.ip.videotron.ca> <F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com>
* 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