Thread: Real newbie question.

Real newbie question.

From
"William D. Tallman"
Date:
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

Re: Real newbie question.

From
Stephan Szabo
Date:
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)



Re: Real newbie question.

From
Evan Zane Macosko
Date:
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:

> 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
>


Re: Real newbie question.

From
Doug McNaught
Date:
"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.

Re: Real newbie question.

From
"Oliver Elphick"
Date:
"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



Re: Real newbie question.

From
Justin Clift
Date:
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