Re: Executing plpgsql scripts using psql, is that possible? - Mailing list pgsql-sql

From John DeSoi
Subject Re: Executing plpgsql scripts using psql, is that possible?
Date
Msg-id F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com
Whole thread Raw
In response to Re: Executing plpgsql scripts using psql, is that possible?  (Daniel CAUNE <d.caune@free.fr>)
List 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



pgsql-sql by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Executing plpgsql scripts using psql, is that possible?
Next
From: Daniel CAUNE
Date:
Subject: Re: Executing plpgsql scripts using psql, is that possible?