Re: Executing plpgsql scripts using psql, is that possible?

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Daniel CAUNE <d(dot)caune(at)free(dot)fr>
Cc: "'pgsql-sql(at)postgresql(dot)org' SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Executing plpgsql scripts using psql, is that possible?
Date: 2006-01-17 02:54:55
Message-ID: F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel CAUNE 2006-01-17 03:10:34 Re: Executing plpgsql scripts using psql, is that possible?
Previous Message Adrian Klaver 2006-01-17 02:35:48 Re: Executing plpgsql scripts using psql, is that possible?