Re: [GENERAL] pasting a lot of commands to psql

2016-07-08 Thread Alvaro Herrera
Tom Lane wrote: > Francisco Olarte writes: > > On Thu, Jul 7, 2016 at 8:18 PM, Alvaro Herrera > > wrote: > >> I've wished sometimes for a "\set READLINE off" psql metacommand for > >> this kind of thing. It's pretty annoying when the text being pasted > >> contains tabs and readline uses to do

Re: [GENERAL] pasting a lot of commands to psql

2016-07-08 Thread Tom Lane
Francisco Olarte writes: > On Thu, Jul 7, 2016 at 8:18 PM, Alvaro Herrera > wrote: >> I've wished sometimes for a "\set READLINE off" psql metacommand for >> this kind of thing. It's pretty annoying when the text being pasted >> contains tabs and readline uses to do completion. > Doesn't 'cat

Re: [GENERAL] pasting a lot of commands to psql

2016-07-08 Thread Francisco Olarte
Hi: On Thu, Jul 7, 2016 at 8:18 PM, Alvaro Herrera wrote: >> You might have better luck with "psql -n", or maybe not. > I've wished sometimes for a "\set READLINE off" psql metacommand for > this kind of thing. It's pretty annoying when the text being pasted > contains tabs and readline uses to

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> You might have better luck with "psql -n", or maybe not. > I've wished sometimes for a "\set READLINE off" psql metacommand for > this kind of thing. It's pretty annoying when the text being pasted > contains tabs and readline uses to do completion. S

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Alvaro Herrera
Merlin Moncure wrote: > Might be a 'xterm vs Mate Terminal' problem. Using raw xterm > performance is great. I like some of the creature comforts of the > mate terminal though. Heh. I've been using lxterminal for a couple of weeks now and I find some of these comfort features rather uncomforta

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread John R Pierce
On 7/7/2016 10:36 AM, Melvin Davidson wrote: It would help if you provided the version of PostgreSQL and the O/S. we still don't know what OS you're using here, and if its something like linux, what desktop environment you're using (gnome, kde, mate, etc) ? -- john r pierce, recycling bits

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Merlin Moncure
On Thu, Jul 7, 2016 at 2:48 PM, Alvaro Herrera wrote: > Merlin Moncure wrote: >> On Thu, Jul 7, 2016 at 1:18 PM, Alvaro Herrera >> wrote: >> > Tom Lane wrote: >> > >> >> You might have better luck with "psql -n", or maybe not. >> > >> > I've wished sometimes for a "\set READLINE off" psql metaco

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread John R Pierce
On 7/7/2016 12:48 PM, Alvaro Herrera wrote: Agreed. I've looked at this problem extensively and concur that >readline is the culprit; I don't think there's any solution on our end >besides filing a bug with the readline. I also agree with the >upthread suggestion that the best workaround today

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Alvaro Herrera
Merlin Moncure wrote: > On Thu, Jul 7, 2016 at 1:18 PM, Alvaro Herrera > wrote: > > Tom Lane wrote: > > > >> You might have better luck with "psql -n", or maybe not. > > > > I've wished sometimes for a "\set READLINE off" psql metacommand for > > this kind of thing. It's pretty annoying when the

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Merlin Moncure
On Thu, Jul 7, 2016 at 1:18 PM, Alvaro Herrera wrote: > Tom Lane wrote: > >> You might have better luck with "psql -n", or maybe not. > > I've wished sometimes for a "\set READLINE off" psql metacommand for > this kind of thing. It's pretty annoying when the text being pasted > contains tabs and

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Alvaro Herrera
Tom Lane wrote: > You might have better luck with "psql -n", or maybe not. I've wished sometimes for a "\set READLINE off" psql metacommand for this kind of thing. It's pretty annoying when the text being pasted contains tabs and readline uses to do completion. -- Álvaro Herrera

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Adrian Klaver
On 07/07/2016 10:41 AM, Dmitry Shalashov wrote: Have you also tried simplifying the sql for multiple values in one statement? this is another possible solution, but it's not answering my general "why is this happening" question. When I have seen this I put it down to encoding issues. It happen

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Rob Sargent
If, on the wild chance you're an emacs user, if the section is in a ".sql" buffer Ctrl-C Ctrl-B will send the entire buffer. Not sure if there's a practical limit on the number of line/statements, but I've used this with a couple of "pages" worth of sql. On 07/07/2016 11:48 AM, Dmitry Shalash

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
Oh sweet! Thanks! Dmitry Shalashov, surfingbird.ru & relap.io 2016-07-07 20:39 GMT+03:00 Scott Mead : > > > On Thu, Jul 7, 2016 at 1:30 PM, Dmitry Shalashov > wrote: > >> Hi Sameer, >> >> I am trying to copy-paste (and execute) random snippets of SQL to psql >> console. >> >> There is another

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
> Have you looked at this line in the file- > INSERT INTO oko_topsites VALUES('russian_federation','calend.ru' in file it's perfectly fine. It's something that happens during paste brokes it. Dmitry Shalashov, surfingbird.ru & relap.io 2016-07-07 20:37 GMT+03:00 Sameer Kumar : > > > On Fri, Ju

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
> Yeah, I've noticed there's a limit on the amount you can paste into psql, > at least on some platforms. AFAICT this must be a readline > bug/limitation, or maybe something about the X cutbuffer protocol That would be sad... Actually if you don't know the answer then I suppose I can't do anythin

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread John R Pierce
On 7/7/2016 10:30 AM, Dmitry Shalashov wrote: There is another ways to do it, which do not involve copy-paste, but I am wondering why is copy-paste won't work. What exactly is happening there... probably your OS's console terminal emulation is overrunning on the large paste. many moving p

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
> Have you also tried simplifying the sql for multiple values in one statement? this is another possible solution, but it's not answering my general "why is this happening" question. This is happening with PostgreSQL 9.5.3 and psql 9.5.3, but actually I am seeing this for a few years... Since I st

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Scott Mead
On Thu, Jul 7, 2016 at 1:39 PM, Scott Mead wrote: > > > On Thu, Jul 7, 2016 at 1:30 PM, Dmitry Shalashov > wrote: > >> Hi Sameer, >> >> I am trying to copy-paste (and execute) random snippets of SQL to psql >> console. >> >> There is another ways to do it, which do not involve copy-paste, but I

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Scott Mead
On Thu, Jul 7, 2016 at 1:30 PM, Dmitry Shalashov wrote: > Hi Sameer, > > I am trying to copy-paste (and execute) random snippets of SQL to psql > console. > > There is another ways to do it, which do not involve copy-paste, but I am > wondering why is copy-paste won't work. What exactly is happen

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Sameer Kumar
On Fri, Jul 8, 2016 at 1:31 AM Dmitry Shalashov wrote: > Hi Sameer, > > I am trying to copy-paste (and execute) random snippets of SQL to psql > console. > Why? Is it some migration of data? You are better off exporting the data to csv and use COPY command. > > There is another ways to do it, w

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Tom Lane
Dmitry Shalashov writes: > 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: Yeah, I've noticed there's a limit on the amount you can p

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Melvin Davidson
On Thu, Jul 7, 2016 at 1:33 PM, Dmitry Shalashov wrote: > > *\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

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
> *\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

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
Hi Sameer, I am trying to copy-paste (and execute) random snippets of SQL to psql console. There is another ways to do it, which do not involve copy-paste, but I am wondering why is copy-paste won't work. What exactly is happening there... Dmitry Shalashov, surfingbird.ru & relap.io 2016-07-07

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Melvin Davidson
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 wrote: > > > On Fri, 8 Jul 2016, 1:23 a.m. Dmitry Shalashov, wrote: > >> Hi everyone. >> >> Let say that I have some sql file with like hundred of

Re: [GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Sameer Kumar
On Fri, 8 Jul 2016, 1:23 a.m. Dmitry Shalashov, 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=> B

[GENERAL] pasting a lot of commands to psql

2016-07-07 Thread Dmitry Shalashov
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.s