Lists: | pgsql-novice |
---|
From: | "John Payne" <jcpayne(at)uw(dot)edu> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | silence and failure of SQL commands |
Date: | 2011-04-28 20:08:02 |
Message-ID: | 003e01cc05df$fb0a8bc0$f11fa340$@edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Sorry for getting defensive, and yes I think Leif's suggestion is much
better than mine. A statistics program I use (R) has a simple and elegant
solution: it drops the cursor one line and puts in a "+" sign. For example,
here I enter the command "read" at the command prompt (>), and then forget
to close the parenthesis:
> read(
+
That doesn't solve the other potential problem, of forgetting to add the
backslash to internal commands, or of putting a semicolon on them, but if I
remember the error output was clearer in the latter case.
John
John Payne
POST Staff Scientist and US Coordinator
www.postcoml.org
Tel. (206) 463-3404
From: | Robert Poor <rdpoor(at)gmail(dot)com> |
---|---|
To: | John Payne <jcpayne(at)uw(dot)edu> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: silence and failure of SQL commands |
Date: | 2011-04-28 20:22:24 |
Message-ID: | BANLkTimrrDwdLv+6WqP02g_ihJ=cOhRnyg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
John:
On Thu, Apr 28, 2011 at 13:08, John Payne <jcpayne(at)uw(dot)edu> wrote:
> A statistics program I use (R) has a simple and elegant
> solution: it drops the cursor one line and puts in a “+” sign.
Just for jollies, try typing this in:
\set PROMPT2 '+%# '
... and then try a command, intentionally omitting the semicolon:
postgres=# SELECT * FROM users
+#
... and see if you like the results. If there's enough acclaim for
it, perhaps Tom will consider making it the default.
From: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: silence and failure of SQL commands |
Date: | 2011-04-28 20:42:44 |
Message-ID: | 201104282242.44925.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On Thursday 28 April 2011 22:22:24 Robert Poor wrote:
> postgres=# SELECT * FROM users
> +#
Just a piece of advice, since this is a novice list: postgres is a privileged
user (per default *the* privileged user), and you should never log in and
execute queries as such unless there is a very specific reason to do so. You
should create a user with ordinary privileges and normally use that account.
Otherwise, you run a great risk of shooting yourself in the foot, as a lot of
people have realized a little too late.
The prompt for a regular user will appear as => while the =# shows that you're
logged in as a super-user.
regards, Leif
From: | Robert Poor <rdpoor(at)gmail(dot)com> |
---|---|
To: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: silence and failure of SQL commands |
Date: | 2011-04-28 20:54:36 |
Message-ID: | BANLkTi=jw8hPKL=2XAzJZBkM9J_h5JtnWA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Lief:
On Thu, Apr 28, 2011 at 13:42, Leif Biberg Kristensen
<leif(at)solumslekt(dot)org> wrote:
> On Thursday 28 April 2011 22:22:24 Robert Poor wrote:
>> postgres=# SELECT * FROM users
>> +#
> The prompt for a regular user will appear as => while the =# shows that you're
> logged in as a super-user.
You are totally correct -- thou shalt not assume super-user privs
without cause. I was using the "#" notation to be consistant with
Tom's previous post.
But this doesn't change my suggestion about changing
\set PROMPT2 '+%# '
The "%#" token at the end expands to "#" for the super user and ">"
for us mere mortals. So I could have typed my example as:
postgres=> SELECT * FROM users
+>
... which I think would satisfy the needs of new-ish users such as
myself and John.
- Rob
From: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: silence and failure of SQL commands |
Date: | 2011-04-28 21:06:30 |
Message-ID: | 201104282306.30552.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On Thursday 28 April 2011 22:54:36 Robert Poor wrote:
> You are totally correct -- thou shalt not assume super-user privs
> without cause. I was using the "#" notation to be consistant with
> Tom's previous post.
>
> But this doesn't change my suggestion about changing
>
> \set PROMPT2 '+%# '
Of course not. I've got no objection to that part.
There are plenty of ways to shoot yourself in the foot in psql as a regular
user, like a DELETE FROM without a WHERE clause. Been there, done that. Took
me a couple of restores to kick that habit.
regards, Leif
From: | Robert Poor <rdpoor(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org, Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
Subject: | Re: silence and failure of SQL commands |
Date: | 2011-04-28 21:17:17 |
Message-ID: | BANLkTindGQ7jAd9sk7RsYje0aGZFjOD=rg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On Thu, Apr 28, 2011 at 14:06, Leif Biberg Kristensen
<leif(at)solumslekt(dot)org> wrote:
> There are plenty of ways to shoot yourself in the foot in psql as a regular
> user, like a DELETE FROM without a WHERE clause. Been there, done that. Took
> me a couple of restores to kick that habit.
Ooogh -- that smarts. Here's another excellent example of What Not To Do:
- Robert