Re: pasting a lot of commands to psql

Поиск
Список
Период
Сортировка
От Sameer Kumar
Тема Re: pasting a lot of commands to psql
Дата
Msg-id CADp-Sm7SNRs7OcxUUGOruVHXUYF=J4KhZMNTN6OMja8tV=NvGA@mail.gmail.com
обсуждение исходный текст
Ответ на pasting a lot of commands to psql  (Dmitry Shalashov <skaurus@gmail.com>)
Ответы Re: pasting a lot of commands to psql  (Melvin Davidson <melvin6925@gmail.com>)
Re: pasting a lot of commands to psql  (Dmitry Shalashov <skaurus@gmail.com>)
Список pgsql-general


On Fri, 8 Jul 2016, 1:23 a.m. Dmitry Shalashov, <skaurus@gmail.com> wrote:
Hi everyone.

Let say that I have some sql file with like hundred of simple statements in it. I `cat` it, copy it to buffer, go to my beloved psql and insert it there.
But somewhere after first few lines it screws over: 

b2b=> BEGIN;
b2b=> INSERT INTO oko_topsites VALUES('russian_federation','ati.su',0,NULL,5);
INSERT INTO oko_topsites VALUES('russian_federation'b2b=> INSERT INTO oko_topsites VALUES('russian_federation','atn.ua',0,NULL,5);
b2b=> INSERT INTO oko_topsites VALUES('russian_federation','audit-it.ru',0,NULL,5);
b2b=> INSERT INTO oko_topsites VALUES('russian_federation','aup.ru',0,NULL,5);
'
b2b=> INSERT INTO oko_topsites VALUES('russian_federation','autocentre.ua',0,NULL,5);

b2b=> INSERT INTO oko_topsites VALUES('russian_federation','autodoc.ru',0,NULL,5);

b2b=> INSERT INTO oko_topsites VALUES('russian_federation','calend.ru'

b2b(> INSERT INTO oko_topsites VALUES('russian_federation','calorizator.ru',0,NULL,5)

Unclosed quotes, unclosed parenthesis - anyway it wont work.

How to safely insert big number of statements to psql at once?
I am aware about "execute this file" \i option of psql, that is not the answer I am looking for, thanks :-)

What are you exactly aiming to do?

Have you tried -
psql  < myfile



Dmitry Shalashov, surfingbird.ru & relap.io
--
--
Best Regards
Sameer Kumar | DB Solution Architect 
ASHNIK PTE. LTD.

101 Cecil Street, #11-11 Tong Eng Building, Singapore 069 533

T: +65 6438 3504 | M: +65 8110 0350 | www.ashnik.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Dmitry Shalashov
Дата:
Сообщение: pasting a lot of commands to psql
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: pasting a lot of commands to psql