Format of pasted query
See original GitHub issueWhen I paste a query with line breaks into pgcli, the lines are joined without a space.
for example:
select col
from table
becomes
select colfrom table
which is a syntax error
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Pasting SQL formatted code into Excel cell
The solution I have is to first get in edit mode of the cell (F2 or double click) and paste the first line...
Read more >How to format a query letter
This is how you format an e-mailed query letter. ... to have stripped any lingering formatting (pasting with Alt-Shift-Command-V can help).
Read more >How to keep the SQL formatting in copy and paste?
How to keep the SQL formatting in copy and paste? · go to Insert tab, Text section, click object button (it's on the...
Read more >Formatting when copying SQL data and pasting in Excel
In the data tab click on Text to Columns, in the pop-up window select Delimited, then uncheck all of the boxes in Step...
Read more >Copying formatted text out of a grid column.
The last thing you want to get when you copy and paste the output is ... an already existing window then either go...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@iamrahulroy That’s debatable. Some of the default behaviors in psql are just terrible, so I’m ok deviating from what is considered default in psql.
But this one is a subjective call and I’m not sure there is a good way to objectively say one is better than the other. I’ve chosen what I think is the most common use case, which is people type in queries in a single line and multi-line queries are rare. So I’ve optimized based on that use case. But if a user prefers to emulate psql there is a config option that allows them to do that.
The philosophy behind pgcli is “Sane defaults out of the box”.
Actually in order to paste multi-line strings like the one in the example, you have to enable the multi-line mode (F3 key).
If you notice the syntax error says
Even though it printed it as
select colfrom table
what it actually did was it pastedselect col
and the newline after that was treated as <enter> and it sent the partial query to the server and then pasted the rest of the query into the buffer.But if you enable multiline-mode and then paste the same snippet, it will be pasted correctly and then you can end it with a semicolon and press enter to execute the query.
Try it out and let me know if it works.