From: | Dmitry Shalashov <skaurus(at)gmail(dot)com> |
---|---|
To: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
Cc: | Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pasting a lot of commands to psql |
Date: | 2016-07-07 17:33:24 |
Message-ID: | CAKPeCUHhbucr4f=9ajX7N3OEFgoL98OOT_xBjY5vh5VWgoOCZw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> *\i your_file_name*
I actually mentioned this way in my original posting. In my case it would
involve copy-paste anyway - to create a file on a system where I have psql
opened.
I may do it that way. But why copy-paste directly to psql results in this
behaviour?
Dmitry Shalashov, surfingbird.ru & relap.io
2016-07-07 20:30 GMT+03:00 Melvin Davidson <melvin6925(at)gmail(dot)com>:
> This might seem a bit basic, but as long as you have a psql session, why
> not just use
> \i your_file_name
>
> On Thu, Jul 7, 2016 at 1:26 PM, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
> wrote:
>
>>
>>
>> On Fri, 8 Jul 2016, 1:23 a.m. Dmitry Shalashov, <skaurus(at)gmail(dot)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
>>
>
> >...I `cat` it, copy it to buffer, go to my beloved psql and insert it
> there.
> This might seem a bit basic, but as long as you have a psql session, why
> not just use
> *\i your_file_name *
>
> No need to cat, copy & paste!
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2016-07-07 17:36:06 | Re: pasting a lot of commands to psql |
Previous Message | Dmitry Shalashov | 2016-07-07 17:30:54 | Re: pasting a lot of commands to psql |