Christopher Brinkley
Christopher Brinkley

Reputation: 344

postgresql - losing command prompt after select from quoted table name

At a relational database command prompt, normally if you enter a query, then you get data back, followed by a new command prompt. Postgresql does this for me too when I select from a table with no quotes in the name. I'm trying to debug the Postgresql setup for a sample Scala application that uses quoted table names, though, and when I select from one of these manually with psql, I get the data, but it is followed by text on an inverted-color background that says

(END)

instead of a new command prompt, and I can't seem to get the command prompt back. What's going on? I haven't found mention of this behavior of Postgresql anywhere.

I'm using a new install of Postgresql 9.3 on Ubuntu 14.04. Attempting to follow instructions in the book the above-linked sample application came from, I'm executing

CREATE TABLE "user" (
id bigserial PRIMARY KEY,
email varchar NOT NULL,
password varchar NOT NULL,
firstname varchar NOT NULL,
lastname varchar NOT NULL
);

Then I'm executing something in the sample application that through a lot of indirection ends up inserting a single row to this table. I don't think the details of this should be relevant. Then as a test I am manually executing the following in psql:

select * from "user";

This ought to be about as trivial as you can get. I'm an old hand at Oracle, but completely new to Postgresql. I see that using quoted names is considered bad practice by many, but I'm trying not to perturb the sample application any more than I have to.

How do I get my command prompt back?

Upvotes: 1

Views: 884

Answers (2)

ravi
ravi

Reputation: 39

We can return back to original terminal by giving Ctrl+C. This works for me in Psql Version 12.

Upvotes: 0

andreas-hofmann
andreas-hofmann

Reputation: 2518

After a query is returned and the results are being displayed, psql switches to a vi/less-like view of the results. Try hitting q to exit that view again and your command prompt should return.

Upvotes: 3

Related Questions