Real newbie question.

Started by William D. Tallmanover 24 years ago6 messagesgeneral
Jump to latest
#1William D. Tallman
wtallman@olypen.com

Just started fiddling with PostgreSQL, and know nothing of databases.

I have the documentation that came with the Mandrake-8.0 installation
written by Thomas Lockhard, and I've perused Bruce Momjian's book online,
and I cannot find the answer to this problem:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

Thanks, and I hope this question isn't too rudimentary for this NG.

Bill Tallman

#2Doug McNaught
doug@wireboard.com
In reply to: William D. Tallman (#1)
Re: Real newbie question.

"William D. Tallman" <wtallman@olypen.com> writes:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

The single quote in the prompt means that you've type an unclosed
single quote.

-Doug
--
Free Dmitry Sklyarov!
http://www.freesklyarov.org/

We will return to our regularly scheduled signature shortly.

#3Evan Zane Macosko
macosko@fas.harvard.edu
In reply to: William D. Tallman (#1)
Re: Real newbie question.

When the prompt changes from an equals sign to a single dash, it means
you have not finished an SQL statement, pgsql is waiting for a semicolon.
A single quote can mean that you didn't close your single quotation, for
example:

UPDATE foo SET column = 'Thursday

If you press return here, psql will be waiting for you to close the
quotation.

Hope this helps.

On Thu, 16 Aug 2001, William D. Tallman wrote:

Show quoted text

Just started fiddling with PostgreSQL, and know nothing of databases.

I have the documentation that came with the Mandrake-8.0 installation
written by Thomas Lockhard, and I've perused Bruce Momjian's book online,
and I cannot find the answer to this problem:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

Thanks, and I hope this question isn't too rudimentary for this NG.

Bill Tallman

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#4Justin Clift
justin@postgresql.org
In reply to: William D. Tallman (#1)
Re: Real newbie question.

Hi Bill,

Have you solved this yet?

When the psql prompt becomes a ' it means you've started a text string
and not ended it. i.e. :

psql# INSERT INTO foo (stringfield) VALUES ('blah blah blah);
psql'#

You need to type another ' then press enter to finish the string. Once
on a new line, type \r to clear the buffer of the command you stuffed,
or \e to open up a window which edits it. i.e. :

psql# INSERT INTO foo (stringfield) VALUES ('blah blah blah);
psql'# safdsadfa
psql'# <Uh oh.. something wrong>
psql'# Aha...
psql'# '
psql# \r
Query buffer reset.
psql# INSERT INTO foo (stringfield) VALUES ('blah blah blah');

:-)

Hope that's helpful, did it from memory, so the exact output may look
slightly different.

Regards and best wishes,

Justin Clift

"William D. Tallman" wrote:

Just started fiddling with PostgreSQL, and know nothing of databases.

I have the documentation that came with the Mandrake-8.0 installation
written by Thomas Lockhard, and I've perused Bruce Momjian's book online,
and I cannot find the answer to this problem:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

Thanks, and I hope this question isn't too rudimentary for this NG.

Bill Tallman

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi

#5Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: William D. Tallman (#1)
Re: Real newbie question.

On Thu, 16 Aug 2001, William D. Tallman wrote:

Just started fiddling with PostgreSQL, and know nothing of databases.

I have the documentation that came with the Mandrake-8.0 installation
written by Thomas Lockhard, and I've perused Bruce Momjian's book online,
and I cannot find the answer to this problem:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

It probably means you have mismatched single quotes which means it
thinks you're in a string constant. '; should generally get you an
error and back to a normal prompt I think (close the constant and
statement)

#6Oliver Elphick
olly@lfix.co.uk
In reply to: William D. Tallman (#1)
Re: Real newbie question.

"William D. Tallman" wrote:

When I am entering values into a table, and make a mistake, sometimes
there is an error message, and sometimes the equal sign in the prompt
becomes a single quote. Error messages I can puzzle out, but I have not
discovered how to recover from the single quote in the prompt. I wind up
having to kill the terminal and start all over

Can someone point me to the explanation of this?

It simply means that you have typed a starting single quote but have
not yet typed the closing quote. You can get a similar effect with
parentheses.

Close the quote, then use \r to clear the buffer.

Example:
junk=# select 'x
junk'# ',*
junk-# from (
junk(# select * from a
junk(# ) as ss
junk-# ;
ERROR: Relation 'a' does not exist

junk=# select '
junk'# aga
junk'# dsfhsh
junk'# \r
junk'# '
junk-# \r
Query buffer reset (cleared).
junk=#

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"But I would not have you to be ignorant, brethren,
concerning them which are asleep, that ye sorrow not,
even as others which have no hope. For if we believe
that Jesus died and rose again, even so them also
which sleep in Jesus will God bring with him."
I Thessalonians 4:13,14