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

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Executing plpgsql scripts using psql, is that possible?
Дата
Msg-id F1E680E6-9E57-4C47-9D6F-79E78FB92560@pgedit.com
обсуждение исходный текст
Ответ на Re: Executing plpgsql scripts using psql, is that possible?  (Daniel CAUNE <d.caune@free.fr>)
Список 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 по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Executing plpgsql scripts using psql, is that possible?
Следующее
От: Daniel CAUNE
Дата:
Сообщение: Re: Executing plpgsql scripts using psql, is that possible?