MySQL-ism help patch for psql

Lists: pgsql-hackers
From: David Christensen <david(at)endpoint(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Magnus Hagander <magnus(at)hagander(dot)net>
Subject: MySQL-ism help patch for psql
Date: 2010-01-19 18:44:03
Message-ID: DE2D34E8-500B-4BC2-B43D-9169CE3B8773@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hey -hackers,

I whipped up a quick patch for supporting some of the common mysql-
based "meta" commands; this is different than some things which have
been discussed in the past, in that it provides just a quick direction
to the appropriate psql command, not an actual alternative syntax for
the same action. This is not intended to be comprehensive, but just
to provide proper direction

The changes are in a single hunk touching only src/bin/psql/
mainloop.c; I modeled the code against the logic currently in place
for the "help" command.

First postgres patch, so bring it on^W^W^Wbe gentle. I obviously
don't expect this to not promote a wild debate/flamewar... ;-) The
formatting and specific wording for the various messages are totally
up-in-the-air, and gladly up for debate.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com
----
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index e2914ae..cc89728 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -197,6 +197,48 @@ MainLoop(FILE *source)
continue;
}

+#define MYSQL_HELP_CHECK(o) \
+ (pg_strncasecmp(line, (o), strlen(o)) == 0 &&\
+ (line[strlen(o)] == '\0' || line[strlen(o)] == ';' ||
isspace((unsigned char) line[strlen(o)])))
+
+#define MYSQL_HELP_OUTPUT(o) \
+ free(line);\
+ printf(_("See:\n " \
+ o\
+ "\n"\
+ " or \\? for general
help with psql commands\n"));\
+ fflush(stdout);\
+ continue;
+
+ /* Present the Postgres equivalent common mysqlisms */
+ if (pset.cur_cmd_interactive && query_buf->len == 0)
+ {
+ if (MYSQL_HELP_CHECK("use"))
+ {
+ MYSQL_HELP_OUTPUT("\\c database");
+ }
+ else if (MYSQL_HELP_CHECK("show tables"))
+ {
+ MYSQL_HELP_OUTPUT("\\dt");
+ }
+ else if (MYSQL_HELP_CHECK("source"))
+ {
+ MYSQL_HELP_OUTPUT("\\i filename");
+ }
+ else if (MYSQL_HELP_CHECK("show databases"))
+ {
+ MYSQL_HELP_OUTPUT("\\l");
+ }
+ else if (MYSQL_HELP_CHECK("describe"))
+ {
+ MYSQL_HELP_OUTPUT("\\d tablename");
+ }
+ else if (MYSQL_HELP_CHECK("load data infile"))
+ {
+ MYSQL_HELP_OUTPUT("\\copy");
+ }
+ }
+
/* echo back if flag is set */
if (pset.echo == PSQL_ECHO_ALL && !
pset.cur_cmd_interactive)
puts(line);


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:25:48
Message-ID: 1263929148.31869.4.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2010-01-19 at 12:44 -0600, David Christensen wrote:
> Hey -hackers,
>
> I whipped up a quick patch for supporting some of the common mysql-
> based "meta" commands; this is different than some things which have
> been discussed in the past, in that it provides just a quick direction
> to the appropriate psql command, not an actual alternative syntax for
> the same action. This is not intended to be comprehensive, but just
> to provide proper direction

I like that idea. There may be a lot of MySQL people that want to use
the next postgresql release, and this would make it easier.

Please add the patch to the next commitfest:

https://commitfest.postgresql.org/action/commitfest_view?id=6

It's small enough that, if others like it as well, maybe it (or
something similar) could still make it in this release.

Regards,
Jeff Davis


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:35:38
Message-ID: 4B56098A.2050009@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jeff Davis wrote:
> On Tue, 2010-01-19 at 12:44 -0600, David Christensen wrote:
>> Hey -hackers,
>>
>> I whipped up a quick patch for supporting some of the common mysql-
>> based "meta" commands; this is different than some things which have
>> been discussed in the past, in that it provides just a quick direction
>> to the appropriate psql command, not an actual alternative syntax for
>> the same action. This is not intended to be comprehensive, but just
>> to provide proper direction
>
> I like that idea. There may be a lot of MySQL people that want to use
> the next postgresql release, and this would make it easier.
>
> Please add the patch to the next commitfest:
>
> https://commitfest.postgresql.org/action/commitfest_view?id=6
>
> It's small enough that, if others like it as well, maybe it (or
> something similar) could still make it in this release.

I'm not convinced that we should start adding syntax helpers like that
to psql. For now it is an arbitrary subset of MySQL stuff, are we going
to add oracle/db2/mssql/drizzle/mariadb and whatnot later on?
Also I can already see people asking "well you already know that this is
that command - why not emulate it fully?".
So -1 on the general idea of providing that kind of stuff (though I
think there is plenty of opportunity to make psql more useful in itself).

Stefan


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:43:50
Message-ID: 1263930230.31869.8.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> I'm not convinced that we should start adding syntax helpers like that
> to psql. For now it is an arbitrary subset of MySQL stuff, are we going
> to add oracle/db2/mssql/drizzle/mariadb and whatnot later on?
> Also I can already see people asking "well you already know that this is
> that command - why not emulate it fully?".

Good points. However, it only takes effect in interactive mode, so I
don't see it as a promise to do much. I'll make an analogy to:

$ git difff
git: 'difff' is not a git-command. See 'git --help'.

Did you mean this?
diff

Regards,
Jeff Davis


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:51:13
Message-ID: 1263930673.31869.12.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2010-01-19 at 11:43 -0800, Jeff Davis wrote:
> > I'm not convinced that we should start adding syntax helpers like that
> > to psql. For now it is an arbitrary subset of MySQL stuff, are we going
> > to add oracle/db2/mssql/drizzle/mariadb and whatnot later on?
> > Also I can already see people asking "well you already know that this is
> > that command - why not emulate it fully?".
>
> Good points. However, it only takes effect in interactive mode, so I
> don't see it as a promise to do much. I'll make an analogy to:
>

On second thought, if it's not a very restricted set of words, it might
limit what commands we can introduce later. In particular I notice that
it uses "load" which is too similar to postgresql's LOAD.

I think the words would need to be prefixed with something to separate
them from normal commands.

Regards,
Jeff Davis


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:52:05
Message-ID: 4B560D65.2000001@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jeff Davis wrote:
>> I'm not convinced that we should start adding syntax helpers like that
>> to psql. For now it is an arbitrary subset of MySQL stuff, are we going
>> to add oracle/db2/mssql/drizzle/mariadb and whatnot later on?
>> Also I can already see people asking "well you already know that this is
>> that command - why not emulate it fully?".
>
> Good points. However, it only takes effect in interactive mode, so I
> don't see it as a promise to do much. I'll make an analogy to:
>
> $ git difff
> git: 'difff' is not a git-command. See 'git --help'.
>
> Did you mean this?
> diff

well the actual output is just:

:~$ git difff
git: 'difff' is not a git-command. See 'git --help'.

which is more or less the same as:

postgres=# \mysql
Invalid command \mysql. Try \? for help.

so I don't really see why we need to add some random second guessing of
what the user actually wanted (and if he is indeed a mysql refugee he
can always use "help" and go on from there).

Stefan


From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 19:59:31
Message-ID: 4B560F23.9030806@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen escreveu:
> I whipped up a quick patch for supporting some of the common mysql-based
> "meta" commands; this is different than some things which have been
> discussed in the past, in that it provides just a quick direction to the
> appropriate psql command, not an actual alternative syntax for the same
> action. This is not intended to be comprehensive, but just to provide
> proper direction
>
This idea was proposed and rejected later; search the archives. IMHO it's more
appropriated for a wiki page than a PostgreSQL-*especific* help command. If we
do that, we'll see requests like "why don't you add _my-favorite-db-here_ help
too?". So, -1.

--
Euler Taveira de Oliveira
http://www.timbira.com/


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:07:46
Message-ID: 1263931666.31869.30.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2010-01-19 at 20:52 +0100, Stefan Kaltenbrunner wrote:
> Jeff Davis wrote:
> >> I'm not convinced that we should start adding syntax helpers like that
> >> to psql. For now it is an arbitrary subset of MySQL stuff, are we going
> >> to add oracle/db2/mssql/drizzle/mariadb and whatnot later on?
> >> Also I can already see people asking "well you already know that this is
> >> that command - why not emulate it fully?".
> >
> > Good points. However, it only takes effect in interactive mode, so I
> > don't see it as a promise to do much. I'll make an analogy to:
> >
> > $ git difff
> > git: 'difff' is not a git-command. See 'git --help'.
> >
> > Did you mean this?
> > diff
>
> well the actual output is just:
>
> :~$ git difff
> git: 'difff' is not a git-command. See 'git --help'.

Well, the actual output on my machine is what I put in the email.

That being said, I don't have much of an opinion, so if you see a
problem, then we can forget it. After all, we would need some kind of a
prefix anyway to avoid conflicting with actual SQL... maybe "\m"? And
that defeats a lot of the purpose.

Regards,
Jeff Davis


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:44:35
Message-ID: 19203.1263933875@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> That being said, I don't have much of an opinion, so if you see a
> problem, then we can forget it. After all, we would need some kind of a
> prefix anyway to avoid conflicting with actual SQL... maybe "\m"? And
> that defeats a lot of the purpose.

Yeah, requiring a prefix would make it completely pointless I think.
The submitted patch tries to avoid that by only matching syntax that's
invalid in Postgres, but that certainly limits how far we can go with
it. (And like you, I'm a bit worried about the LOAD case.)

The last go-round on this was just a couple months ago:
http://archives.postgresql.org/pgsql-bugs/2009-11/msg00241.php
although I guess that was aimed at a slightly different idea,
namely making "show databases" etc actually *work*. This one at
least has a level of complication that's more in keeping with the
possible gain.

The previous discussion started from the idea that only DESCRIBE,
SHOW DATABASES/TABLES, and USE were worth worrying about. If we
were to agree that we'd go that far and no farther, the potential
conflict with SQL syntax would be pretty limited. I have little
enough experience with mysql to not want to opine too much on how
useful that would be, but it does seem like those are commands
I use right away anytime I am using mysql.

regards, tom lane


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:49:37
Message-ID: 9837222c1001191249o2dacba49v4b529137c22dd521@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jan 19, 2010 at 21:44, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
>> That being said, I don't have much of an opinion, so if you see a
>> problem, then we can forget it. After all, we would need some kind of a
>> prefix anyway to avoid conflicting with actual SQL... maybe "\m"? And
>> that defeats a lot of the purpose.
>
> Yeah, requiring a prefix would make it completely pointless I think.

Definitely.

> The submitted patch tries to avoid that by only matching syntax that's
> invalid in Postgres, but that certainly limits how far we can go with
> it.  (And like you, I'm a bit worried about the LOAD case.)
>
> The last go-round on this was just a couple months ago:
> http://archives.postgresql.org/pgsql-bugs/2009-11/msg00241.php
> although I guess that was aimed at a slightly different idea,
> namely making "show databases" etc actually *work*.  This one at
> least has a level of complication that's more in keeping with the
> possible gain.

I think the gain is actually better with this than to try to do the
work. We'd want it to teach people what to do.

> The previous discussion started from the idea that only DESCRIBE,
> SHOW DATABASES/TABLES, and USE were worth worrying about.  If we
> were to agree that we'd go that far and no farther, the potential
> conflict with SQL syntax would be pretty limited.  I have little
> enough experience with mysql to not want to opine too much on how
> useful that would be, but it does seem like those are commands
> I use right away anytime I am using mysql.

I think just getting te most common cases would still be quite
helpful. Once you get the user to realize that "hey, that backslash
thing seems to do stuff", you've gone most of the way.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: David Christensen <david(at)endpoint(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:54:36
Message-ID: A4D662A0-F17C-4802-B9FC-7D7C1B948D71@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> The previous discussion started from the idea that only DESCRIBE,
> SHOW DATABASES/TABLES, and USE were worth worrying about. If we
> were to agree that we'd go that far and no farther, the potential
> conflict with SQL syntax would be pretty limited. I have little
> enough experience with mysql to not want to opine too much on how
> useful that would be, but it does seem like those are commands
> I use right away anytime I am using mysql.

I have no problems paring down the list of cases; these were the
correspondences I saw off the top of my head. I definitely don't want
to conflict with any SQL syntax. The exact wording/output of the
messages can be adjusted at whim.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:56:18
Message-ID: 201001192056.o0JKuIG24961@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > That being said, I don't have much of an opinion, so if you see a
> > problem, then we can forget it. After all, we would need some kind of a
> > prefix anyway to avoid conflicting with actual SQL... maybe "\m"? And
> > that defeats a lot of the purpose.
>
> Yeah, requiring a prefix would make it completely pointless I think.
> The submitted patch tries to avoid that by only matching syntax that's
> invalid in Postgres, but that certainly limits how far we can go with
> it. (And like you, I'm a bit worried about the LOAD case.)
>
> The last go-round on this was just a couple months ago:
> http://archives.postgresql.org/pgsql-bugs/2009-11/msg00241.php
> although I guess that was aimed at a slightly different idea,
> namely making "show databases" etc actually *work*. This one at
> least has a level of complication that's more in keeping with the
> possible gain.
>
> The previous discussion started from the idea that only DESCRIBE,
> SHOW DATABASES/TABLES, and USE were worth worrying about. If we
> were to agree that we'd go that far and no farther, the potential
> conflict with SQL syntax would be pretty limited. I have little
> enough experience with mysql to not want to opine too much on how
> useful that would be, but it does seem like those are commands
> I use right away anytime I am using mysql.

Agreed. I think this discussion mirrors the psql 'help' feature we
added in 8.4. After a lot of discussion we decided that a limited
'help' functionality was the best approach --- the more we added the
less attractive it became.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 20:58:52
Message-ID: 4B561D0C.5010207@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
>> That being said, I don't have much of an opinion, so if you see a
>> problem, then we can forget it. After all, we would need some kind of a
>> prefix anyway to avoid conflicting with actual SQL... maybe "\m"? And
>> that defeats a lot of the purpose.
>
> Yeah, requiring a prefix would make it completely pointless I think.
> The submitted patch tries to avoid that by only matching syntax that's
> invalid in Postgres, but that certainly limits how far we can go with
> it. (And like you, I'm a bit worried about the LOAD case.)

yeah requiring a prefix would make it completely pointless

>
> The last go-round on this was just a couple months ago:
> http://archives.postgresql.org/pgsql-bugs/2009-11/msg00241.php
> although I guess that was aimed at a slightly different idea,
> namely making "show databases" etc actually *work*. This one at
> least has a level of complication that's more in keeping with the
> possible gain.

well providing a hint that one should use different command will only
lead to the path "uhm why not make it work as well" - and we also need
to recongnized that our replacements for some of those commands are not
really equivalent in most cases.

>
> The previous discussion started from the idea that only DESCRIBE,
> SHOW DATABASES/TABLES, and USE were worth worrying about. If we
> were to agree that we'd go that far and no farther, the potential
> conflict with SQL syntax would be pretty limited. I have little
> enough experience with mysql to not want to opine too much on how
> useful that would be, but it does seem like those are commands
> I use right away anytime I am using mysql.

well those are the most common ones I guess for the current version of
the mysql commandline client - but what about future versions or the
fact that we only have partial replacements for some of those that
people are really asking for?

Stefan


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Christensen <david(at)endpoint(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:12:43
Message-ID: 4B56204B.1080006@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen wrote:
>
> + if (MYSQL_HELP_CHECK("use"))
> + {
> + MYSQL_HELP_OUTPUT("\\c database");
> + }
>
[snip]
> + else if (MYSQL_HELP_CHECK("load data infile"))
> + {
> + MYSQL_HELP_OUTPUT("\\copy");
> + }
>

Quite apart from any considerations covered by other people, these two
at least could be positively misleading ... the psql commands are not
exact equivalents of the MySQL commands, AIUI.

cheers

andrew


From: David Christensen <david(at)endpoint(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:15:37
Message-ID: F51B735F-C890-4E73-9D93-4C217F8A8EC8@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 2:58 PM, Stefan Kaltenbrunner wrote:

> Tom Lane wrote:
>> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
>>> That being said, I don't have much of an opinion, so if you see a
>>> problem, then we can forget it. After all, we would need some kind
>>> of a
>>> prefix anyway to avoid conflicting with actual SQL... maybe "\m"?
>>> And
>>> that defeats a lot of the purpose.
>> Yeah, requiring a prefix would make it completely pointless I think.
>> The submitted patch tries to avoid that by only matching syntax
>> that's
>> invalid in Postgres, but that certainly limits how far we can go with
>> it. (And like you, I'm a bit worried about the LOAD case.)
>
> yeah requiring a prefix would make it completely pointless

Agreed.

>> The last go-round on this was just a couple months ago:
>> http://archives.postgresql.org/pgsql-bugs/2009-11/msg00241.php
>> although I guess that was aimed at a slightly different idea,
>> namely making "show databases" etc actually *work*. This one at
>> least has a level of complication that's more in keeping with the
>> possible gain.
>
> well providing a hint that one should use different command will
> only lead to the path "uhm why not make it work as well" - and we
> also need to recongnized that our replacements for some of those
> commands are not really equivalent in most cases.

I think if you set this line ahead of time, you don't have to worry
about the detractors; this is equivalent to vim outputting
"Type :quit<Enter> to exit Vim" when you type emacs' quit sequence.
The intent is to show the correct way or to provide a helpful reminder
to people new to psql, not to make it work the same.

>> The previous discussion started from the idea that only DESCRIBE,
>> SHOW DATABASES/TABLES, and USE were worth worrying about. If we
>> were to agree that we'd go that far and no farther, the potential
>> conflict with SQL syntax would be pretty limited. I have little
>> enough experience with mysql to not want to opine too much on how
>> useful that would be, but it does seem like those are commands
>> I use right away anytime I am using mysql.
>
> well those are the most common ones I guess for the current version
> of the mysql commandline client - but what about future versions or
> the fact that we only have partial replacements for some of those
> that people are really asking for?

I think it captures the intent of the people using the tool, and that
it adds a small net benefit in usability for those people. Deciding
to support this small subset does not obligate you to expand the scope
in the future. (Hey ma, this slope ain't slippery!)

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: David Christensen <david(at)endpoint(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:16:41
Message-ID: 7EAEB0FB-615A-476A-8EDA-787EC1D817A7@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 3:12 PM, Andrew Dunstan wrote:

>
>
> David Christensen wrote:
>>
>> + if (MYSQL_HELP_CHECK("use"))
>> + {
>> + MYSQL_HELP_OUTPUT("\\c database");
>> + }
>>
> [snip]
>> + else if (MYSQL_HELP_CHECK("load data
>> infile"))
>> + {
>> + MYSQL_HELP_OUTPUT("\\copy");
>> + }
>>
>
> Quite apart from any considerations covered by other people, these
> two at least could be positively misleading ... the psql commands
> are not exact equivalents of the MySQL commands, AIUI.

The \copy could definitely be considered a stretch; I know \c supports
more options than the equivalent USE, but isn't it a proper superset
of functionality?

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:18:34
Message-ID: 103804E6-0ECD-439A-AC0D-3E522F486FDA@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jan 19, 2010, at 12:58 PM, Stefan Kaltenbrunner wrote:

> well providing a hint that one should use different command will only lead to the path "uhm why not make it work as well"

I don't think so. People know it's a different database. They'd be thrilled just to get the hint. I think it's a great idea (notwithstanding the caveats mentioned up-thread).

Best,

David


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Christensen <david(at)endpoint(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:39:16
Message-ID: 4B562684.1080009@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen wrote:
>>
>> Quite apart from any considerations covered by other people, these
>> two at least could be positively misleading ... the psql commands are
>> not exact equivalents of the MySQL commands, AIUI.
>
> The \copy could definitely be considered a stretch; I know \c supports
> more options than the equivalent USE, but isn't it a proper superset
> of functionality?
>
>

Not really. "use" sets the default db in MySQL (and other DBs like
Sybase and MSSQL). But you don't really connect to a particular
database, unlike Postgres - you connect to the server. And you can
directly query other databases than the default, again unlike Postgres
where you can only directly query the database you're connected to. In
fact, "use" is part of MySQL's SQL dialect, and can be used from any
client, not just part of the metacommands of their commandline client.
See <http://dev.mysql.com/doc/refman/5.5/en/use.html>

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:39:57
Message-ID: 20231.1263937197@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen <david(at)endpoint(dot)com> writes:
> On Jan 19, 2010, at 2:58 PM, Stefan Kaltenbrunner wrote:
>> well those are the most common ones I guess for the current version
>> of the mysql commandline client - but what about future versions or
>> the fact that we only have partial replacements for some of those
>> that people are really asking for?

> I think it captures the intent of the people using the tool, and that
> it adds a small net benefit in usability for those people. Deciding
> to support this small subset does not obligate you to expand the scope
> in the future. (Hey ma, this slope ain't slippery!)

I thought Magnus had a really good point: covering these four cases will
probably be enough to teach newbies to look at psql's backslash
commands. And once they absorb that, we're over a big hump.

Also, TTBOMK these commands have been in mysql for many years. I don't
think that commands that might get introduced in future versions would
have anywhere near the same degree of wired-into-the-fingertips uptake
to them.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:53:37
Message-ID: 20539.1263938017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen <david(at)endpoint(dot)com> writes:
> On Jan 19, 2010, at 3:12 PM, Andrew Dunstan wrote:
>> Quite apart from any considerations covered by other people, these
>> two at least could be positively misleading ... the psql commands
>> are not exact equivalents of the MySQL commands, AIUI.

> The \copy could definitely be considered a stretch; I know \c supports
> more options than the equivalent USE, but isn't it a proper superset
> of functionality?

No, in fact I was going to bring up exactly that point, but Andrew beat
me to it. You can make a good case that mysql databases are more nearly
a match to PG schemas than to PG databases. So arguably instead of "use
foo" a mysql convert would prefer "set search_path = foo". This would
have been a serious headache if we'd accepted the earlier plan of trying
to implement equivalent functionality. In this patch, it could probably
be accommodated by having the help message read something like

Perhaps you want "\c database" or "set search_path = schema".

Or we could punt and leave this one out of the set that have help
messages.

regards, tom lane


From: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 21:57:06
Message-ID: 1263938226.3166.146.camel@hp-laptop2.gunduz.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2010-01-19 at 11:25 -0800, Jeff Davis wrote:

> I like that idea. There may be a lot of MySQL people that want to use
> the next postgresql release, and this would make it easier.

I disagree. If they want to use PostgreSQL, they should learn our
syntax. How can you make sure that this will be enough for them? What if
they want more?

I have administrated lots of MySQL server until I started working for
Command Prompt (I still take a look at one once a month, for a
government related thing).

+#define MYSQL_HELP_CHECK(o) \

What if some other people will come up with the idea of adding similar
functionality for their favorite database? The only exception will be
Informix IMHO, because of historical reasons.

So, -1 from me for adding such a support for MySQL's cli commands.
--
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz


From: David Christensen <david(at)endpoint(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:00:14
Message-ID: A357EFC4-EB82-447D-A08E-BC97867D3D08@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 3:39 PM, Tom Lane wrote:

> David Christensen <david(at)endpoint(dot)com> writes:
>> On Jan 19, 2010, at 2:58 PM, Stefan Kaltenbrunner wrote:
>>> well those are the most common ones I guess for the current version
>>> of the mysql commandline client - but what about future versions or
>>> the fact that we only have partial replacements for some of those
>>> that people are really asking for?
>
>> I think it captures the intent of the people using the tool, and that
>> it adds a small net benefit in usability for those people. Deciding
>> to support this small subset does not obligate you to expand the
>> scope
>> in the future. (Hey ma, this slope ain't slippery!)
>
> I thought Magnus had a really good point: covering these four cases
> will
> probably be enough to teach newbies to look at psql's backslash
> commands. And once they absorb that, we're over a big hump.

Okay, so I can revise the code to cover those four cases specifically
(or three, depending); is there any specific feedback as to the output/
formatting of the messages themselves?

Currently, a session will look like the following:

machack:machack:5485=# show tables;
See:
\d
or \? for general help with psql commands
machack:machack:5485=#

Said formatting looks like it could use some improvement, open to
suggestions, but something on a single line seems more useful.

> Also, TTBOMK these commands have been in mysql for many years. I
> don't
> think that commands that might get introduced in future versions would
> have anywhere near the same degree of wired-into-the-fingertips uptake
> to them.

They were in there since when I last used mysql on a regular basis, so
going on 10 years now. i.e., pretty safe, and pretty engrained in
muscle-memory.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: David Christensen <david(at)endpoint(dot)com>
To: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:04:33
Message-ID: 993CF61C-66FC-416A-8EB2-B834B363D449@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 3:57 PM, Devrim GÜNDÜZ wrote:

> On Tue, 2010-01-19 at 11:25 -0800, Jeff Davis wrote:
>
>> I like that idea. There may be a lot of MySQL people that want to use
>> the next postgresql release, and this would make it easier.
>
> I disagree. If they want to use PostgreSQL, they should learn our
> syntax. How can you make sure that this will be enough for them?
> What if
> they want more?

This is intended to be a gentle nudge in the right direction, not a
replacement for their regular syntax. This does not perform the
command in question, just points them to the right one, along with a
general reminder that all kinds of good help is available via \?.

> I have administrated lots of MySQL server until I started working for
> Command Prompt (I still take a look at one once a month, for a
> government related thing).
>
> +#define MYSQL_HELP_CHECK(o) \
>
> What if some other people will come up with the idea of adding similar
> functionality for their favorite database? The only exception will be
> Informix IMHO, because of historical reasons.

I'm not sure what you're saying here WRT Informix; if there is
substantial desire and a large enough group that would find such
newbie hints useful, I'd say we could generalize this more, but I
don't think this patch obligates one to any such future proposals.

> So, -1 from me for adding such a support for MySQL's cli commands.
> --
> Devrim GÜNDÜZ, RHCE
> Command Prompt - http://www.CommandPrompt.com
> devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
> http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:14:31
Message-ID: EB004BBE-99FE-48EC-8527-A4FF273B683D@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jan 19, 2010, at 1:39 PM, Tom Lane wrote:

> I thought Magnus had a really good point: covering these four cases will
> probably be enough to teach newbies to look at psql's backslash
> commands. And once they absorb that, we're over a big hump.

+1

On Jan 19, 2010, at 1:57 PM, Devrim GÜNDÜZ wrote:

> I disagree. If they want to use PostgreSQL, they should learn our
> syntax. How can you make sure that this will be enough for them? What if
> they want more?

Why would they want more? It's not MySQL, and they know that. If we give them some very minor helpful hints for the most common things they try to do, it would be a huge benefit to them. I know I've badly wanted the opposite when I've had to use MySQL, but I don't expect MySQL to implement \c for me.

> What if some other people will come up with the idea of adding similar
> functionality for their favorite database? The only exception will be
> Informix IMHO, because of historical reasons.

I think it'd be helpful for other databases, too. Oracle comes to mind: What commands are finger-trained in Oracle DBAs?

Best,

David


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:23:09
Message-ID: 603c8f071001191423o6e600b92s9d6c4a8f7d140692@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jan 19, 2010 at 5:14 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
> Why would they want more? It's not MySQL, and they know that. If we give them some very minor helpful hints for the most common things they try to do, it would be a huge benefit to them. I know I've badly wanted the opposite when I've had to use MySQL, but I don't expect MySQL to implement \c for me.

+1. I think this is a well-thought out proposal. I like Tom's
suggestion upthread for how to handle \c.

Although the deadline for patches for 8.5 has supposedly already passed....

...Robert


From: Rob Wultsch <wultsch(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:31:30
Message-ID: 2c5ef4e31001191431y32d3539u75f43069bc5bcd7e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jan 19, 2010 at 3:14 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
> On Jan 19, 2010, at 1:39 PM, Tom Lane wrote:
>
>> I thought Magnus had a really good point: covering these four cases will
>> probably be enough to teach newbies to look at psql's backslash
>> commands.  And once they absorb that, we're over a big hump.
>
> +1
>
> On Jan 19, 2010, at 1:57 PM, Devrim GÜNDÜZ wrote:
>
>> I disagree. If they want to use PostgreSQL, they should learn our
>> syntax. How can you make sure that this will be enough for them? What if
>> they want more?
>
> Why would they want more? It's not MySQL, and they know that. If we give them some very minor helpful hints for the most common things they try to do, it would be a huge benefit to them. I know I've badly wanted the opposite when I've had to use MySQL, but I don't expect MySQL to implement \c for me.
>
>> What if some other people will come up with the idea of adding similar
>> functionality for their favorite database? The only exception will be
>> Informix IMHO, because of historical reasons.
>
> I think it'd be helpful for other databases, too. Oracle comes to mind: What commands are finger-trained in Oracle DBAs?
>
> Best,
>
> David
>

As a MySQL DBA the commands I think are most useful are:
show databases (please punt this, most MySQL dba's that I have worked
with will need to consider the difference between a db and a schema)
use database (please punt)
LOAD DATA INFILE(please punt, they should look at the manual as COPY
is... well, more limited)
show tables
desc(ribe) table
show processlist

I suggest adding:
+ else if (MYSQL_HELP_CHECK("show processlist"))
+ {
+ MYSQL_HELP_OUTPUT("SELECT * from
pg_stat_activity");
+ }
+ else if (MYSQL_HELP_CHECK("desc"))
+ {
+ MYSQL_HELP_OUTPUT("\\d tablename");
+ }

--
Rob Wultsch
wultsch(at)gmail(dot)com


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-19 22:37:36
Message-ID: m27hrd7mbz.fsf@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Although the deadline for patches for 8.5 has supposedly already passed....

I guess it already got more review than some of the commit fest items
already…

Regards,
--
dim


From: David Christensen <david(at)endpoint(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Patch rev 2: MySQL-ism help patch for psql
Date: 2010-01-20 00:01:29
Message-ID: 27B2123E-3F0B-4BBF-A950-DB88568067A9@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 4:23 PM, Robert Haas wrote:

> On Tue, Jan 19, 2010 at 5:14 PM, David E. Wheeler <david(at)kineticode(dot)com
> > wrote:
>> Why would they want more? It's not MySQL, and they know that. If we
>> give them some very minor helpful hints for the most common things
>> they try to do, it would be a huge benefit to them. I know I've
>> badly wanted the opposite when I've had to use MySQL, but I don't
>> expect MySQL to implement \c for me.
>
> +1. I think this is a well-thought out proposal. I like Tom's
> suggestion upthread for how to handle \c.

I've attached a second revision of this patch incorporating the
various feedback I've received.

> Although the deadline for patches for 8.5 has supposedly already
> passed....

Yeah, I realized this after I scratched my itch, and had just thought
I would send to the list any way for after the CF; you can commit or
bump as needed. Patch enclosed as a context-diff attachment this time.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com

Attachment Content-Type Size
mysql-help.patch application/octet-stream 1.5 KB

From: David Christensen <david(at)endpoint(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Patch rev 2: MySQL-ism help patch for psql
Date: 2010-01-20 00:05:32
Message-ID: BF1176F1-6D5C-427B-97EE-83AC305E805F@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 19, 2010, at 6:01 PM, David Christensen wrote:

>
> On Jan 19, 2010, at 4:23 PM, Robert Haas wrote:
>
>> On Tue, Jan 19, 2010 at 5:14 PM, David E. Wheeler <david(at)kineticode(dot)com
>> > wrote:
>>> Why would they want more? It's not MySQL, and they know that. If
>>> we give them some very minor helpful hints for the most common
>>> things they try to do, it would be a huge benefit to them. I know
>>> I've badly wanted the opposite when I've had to use MySQL, but I
>>> don't expect MySQL to implement \c for me.
>>
>> +1. I think this is a well-thought out proposal. I like Tom's
>> suggestion upthread for how to handle \c.
>
> I've attached a second revision of this patch incorporating the
> various feedback I've received.
>
>> Although the deadline for patches for 8.5 has supposedly already
>> passed....
>
> Yeah, I realized this after I scratched my itch, and had just
> thought I would send to the list any way for after the CF; you can
> commit or bump as needed. Patch enclosed as a context-diff
> attachment this time.

I also forgot to enclose the sample output in this version, based
largely on Tom's wording for the USE usecase:

----
machack:machack:5432=# show tables

Perhaps you want "\dt"?
See \? for help with psql commands

[Tue Jan 19 18:04:50 CST 2010]
machack:machack:5432=# use database;

Perhaps you want "\c database" or "set search_path = schema"?
See \? for help with psql commands

[Tue Jan 19 18:05:07 CST 2010]
machack:machack:5432=#
----

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Patch rev 2: MySQL-ism help patch for psql
Date: 2010-01-20 00:13:27
Message-ID: 23201.1263946407@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen <david(at)endpoint(dot)com> writes:
> I also forgot to enclose the sample output in this version, based
> largely on Tom's wording for the USE usecase:

Please note that that was just an off-the-cuff example, not something
I thought was perfect as is ...

regards, tom lane


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Rob Wultsch <wultsch(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 01:54:44
Message-ID: 4B566264.4070808@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 20/01/2010 6:31 AM, Rob Wultsch wrote:

> As a MySQL DBA the commands I think are most useful are:
> show databases (please punt this, most MySQL dba's that I have worked
> with will need to consider the difference between a db and a schema)
> use database (please punt)

So perhaps for SHOW DATABASES the help should suggest:

"
\l - list databases; or
\dn - list schema
"

?

--
Craig Ringer


From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 02:56:27
Message-ID: 397b07b4331446bb103ee9252fca81a5@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> Why would they want more? It's not MySQL, and they know that.
> If we give them some very minor helpful hints for the most
> common things they try to do, it would be a huge benefit to them.

+1

>> What if some other people will come up with the idea of adding similar
>> functionality for their favorite database? The only exception will be
>> Informix IMHO, because of historical reasons.

> I think it'd be helpful for other databases, too. Oracle comes to mind:
> What commands are finger-trained in Oracle DBAs?

Ha! Best laugh I've had all week. The finger training consists of "double
click the mouse, navigate the GUI to find your table...". For command line,
you have monstrosities such as "select * from ALL_ALL_TABLES"
and "select * from TABS" - unless they've implemented some sort of shortcuts
since the last time I used Oracle. Which seems very unlikely, as they
obviously have no love for sqlplus (Oracle's command line client), which
has been stuck technologically in place for decades (hello, readline?)

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 201001192155
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAktWcMkACgkQvJuQZxSWSsgAoQCgw/9e+viAs6RyGCeuSze42oqx
Ym4An2Q9FSpXYkX1ZC507Y/NwUb3ODmG
=fnUL
-----END PGP SIGNATURE-----


From: Greg Stark <stark(at)mit(dot)edu>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 09:19:56
Message-ID: 407d949e1001200119g49a314a1ra2c3725a59802aa2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

this is mostly true. I don't think any Oracle DBA will expect ALL_TABLES our
DBA_TABLES to be there.

however DESCRIBE and HELP would be the two that come to mind.

greg

On 20 Jan 2010 02:56, "Greg Sabino Mullane" <greg(at)turnstep(dot)com> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> Why would they want more? It's not MySQL, and they know that. > If we give
them some very minor ...
+1

>> What if some other people will come up with the idea of adding similar >>
functionality for thei...
Ha! Best laugh I've had all week. The finger training consists of "double
click the mouse, navigate the GUI to find your table...". For command line,
you have monstrosities such as "select * from ALL_ALL_TABLES"
and "select * from TABS" - unless they've implemented some sort of shortcuts
since the last time I used Oracle. Which seems very unlikely, as they
obviously have no love for sqlplus (Oracle's command line client), which
has been stuck technologically in place for decades (hello, readline?)

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 201001192155
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAktWcMkACgkQvJuQZxSWSsgAoQCgw/9e+viAs6RyGCeuSze42oqx
Ym4An2Q9FSpXYkX1ZC507Y/NwUb3ODmG
=fnUL
-----END PGP SIGNATURE-----

-- Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org) To
make changes to your su...


From: Rob Wultsch <wultsch(at)gmail(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Patch rev 2: MySQL-ism help patch for psql
Date: 2010-01-20 12:11:03
Message-ID: 2c5ef4e31001200411vd1ed87bjb0862debae686078@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jan 19, 2010 at 5:01 PM, David Christensen <david(at)endpoint(dot)com> wrote:
>
> On Jan 19, 2010, at 4:23 PM, Robert Haas wrote:
>
>> On Tue, Jan 19, 2010 at 5:14 PM, David E. Wheeler <david(at)kineticode(dot)com>
>> wrote:
>>>
>>> Why would they want more? It's not MySQL, and they know that. If we give
>>> them some very minor helpful hints for the most common things they try to
>>> do, it would be a huge benefit to them. I know I've badly wanted the
>>> opposite when I've had to use MySQL, but I don't expect MySQL to implement
>>> \c for me.
>>
>> +1.  I think this is a well-thought out proposal.  I like Tom's
>> suggestion upthread for how to handle \c.
>
> I've attached a second revision of this patch incorporating the various
> feedback I've received.
>
>> Although the deadline for patches for 8.5 has supposedly already
>> passed....
>
> Yeah, I realized this after I scratched my itch, and had just thought I
> would send to the list any way for after the CF; you can commit or bump as
> needed.  Patch enclosed as a context-diff attachment this time.
>
> Regards,
>
> David
> --
> David Christensen
> End Point Corporation
> david(at)endpoint(dot)com

Although I have a snowballs chance in hell to convert my coworkers to
using pg I think that this patch would make such an outcome more
likely. Please consider what a MySQL dba does when he gets a call at
3AM that a server
(p3.any43.db69.I_have_no_clue_what_this_stupid_f'ing_server_is.wtf.pg
) is at max-connections. I think that some helpful hints for non-pg
dba's that are using pg in some capacity are a very good idea.

--
Rob Wultsch
wultsch(at)gmail(dot)com


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 13:15:27
Message-ID: 1263993327.20032.5.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tis, 2010-01-19 at 11:43 -0800, Jeff Davis wrote:
> I'll make an analogy to:
>
> $ git difff
> git: 'difff' is not a git-command. See 'git --help'.
>
> Did you mean this?
> diff

This is presumably spelling-based, which might be an interesting feature
(although probably useless for psql's single-letter commands). Maybe
this analogy is more interesting, for a user that recently used cvs:

$ git update
git: 'update' is not a git-command. See 'git --help'.

Did you mean this?
update-ref

--> Probably not.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 13:36:55
Message-ID: 1263994615.20032.23.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tis, 2010-01-19 at 16:00 -0600, David Christensen wrote:
> Currently, a session will look like the following:
>
> machack:machack:5485=# show tables;
> See:
> \d
> or \? for general help with psql commands
> machack:machack:5485=#

I think if you make "show tables" and the others actually execute \d and
then possibly print a notice about what the "better" command would have
been, you actually *help* people do their work instead of appearing to
be a smartass -- "See, we took the time to research what you want to do,
and here is why it's wrong."

Moreover, the backslash is really hard to type on some keyboards, so I'd
expect significant uptake for people to use the SHOW variants as their
primary method.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 14:05:33
Message-ID: 201001201405.o0KE5Xv29465@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> On tis, 2010-01-19 at 16:00 -0600, David Christensen wrote:
> > Currently, a session will look like the following:
> >
> > machack:machack:5485=# show tables;
> > See:
> > \d
> > or \? for general help with psql commands
> > machack:machack:5485=#
>
> I think if you make "show tables" and the others actually execute \d and
> then possibly print a notice about what the "better" command would have
> been, you actually *help* people do their work instead of appearing to
> be a smartass -- "See, we took the time to research what you want to do,
> and here is why it's wrong."
>
> Moreover, the backslash is really hard to type on some keyboards, so I'd
> expect significant uptake for people to use the SHOW variants as their
> primary method.

I disagree. No one has complained that we are being a "smartass" by
reporting this for "help" in psql:

You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

while to be really helpful we would display \?. After extensive
discussion we chose against that because we wanted to steer people to
the proper commands, rather than have them consider 'help' as a valid
command. The same is true for the MySQL commands --- we just want to
point people to the proper commands.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 14:26:39
Message-ID: 1263997599.20032.24.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On ons, 2010-01-20 at 09:05 -0500, Bruce Momjian wrote:
> I disagree. No one has complained that we are being a "smartass" by
> reporting this for "help" in psql:
>
> You are using psql, the command-line interface to PostgreSQL.
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help with psql commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> while to be really helpful we would display \?. After extensive
> discussion we chose against that because we wanted to steer people to
> the proper commands, rather than have them consider 'help' as a valid
> command. The same is true for the MySQL commands --- we just want to
> point people to the proper commands.

That's not the same thing. The user typed "help" and you help him. If
the user types "show tables", you show him the tables. If the user
typed "show tables" and you send him a help message, that is not what
the user wanted.


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 14:27:53
Message-ID: 603c8f071001200627i1957f3d5yc83bac82c5ce3b89@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jan 20, 2010 at 9:05 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Peter Eisentraut wrote:
>> On tis, 2010-01-19 at 16:00 -0600, David Christensen wrote:
>> > Currently, a session will look like the following:
>> >
>> >    machack:machack:5485=# show tables;
>> >    See:
>> >           \d
>> >           or \? for general help with psql commands
>> >    machack:machack:5485=#
>>
>> I think if you make "show tables" and the others actually execute \d and
>> then possibly print a notice about what the "better" command would have
>> been, you actually *help* people do their work instead of appearing to
>> be a smartass -- "See, we took the time to research what you want to do,
>> and here is why it's wrong."
>>
>> Moreover, the backslash is really hard to type on some keyboards, so I'd
>> expect significant uptake for people to use the SHOW variants as their
>> primary method.
>
> I disagree.   No one has complained that we are being a "smartass" by
> reporting this for "help" in psql:
>
>        You are using psql, the command-line interface to PostgreSQL.
>        Type:  \copyright for distribution terms
>               \h for help with SQL commands
>               \? for help with psql commands
>               \g or terminate with semicolon to execute query
>               \q to quit
>
> while to be really helpful we would display \?.  After extensive
> discussion we chose against that because we wanted to steer people to
> the proper commands, rather than have them consider 'help' as a valid
> command.  The same is true for the MySQL commands --- we just want to
> point people to the proper commands.

+1.

...Robert


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 14:48:26
Message-ID: 603c8f071001200648x51a9933by6af7c72c618fc872@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jan 20, 2010 at 9:26 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On ons, 2010-01-20 at 09:05 -0500, Bruce Momjian wrote:
>> I disagree.   No one has complained that we are being a "smartass" by
>> reporting this for "help" in psql:
>>
>>         You are using psql, the command-line interface to PostgreSQL.
>>         Type:  \copyright for distribution terms
>>                \h for help with SQL commands
>>                \? for help with psql commands
>>                \g or terminate with semicolon to execute query
>>                \q to quit
>>
>> while to be really helpful we would display \?.  After extensive
>> discussion we chose against that because we wanted to steer people to
>> the proper commands, rather than have them consider 'help' as a valid
>> command.  The same is true for the MySQL commands --- we just want to
>> point people to the proper commands.
>
> That's not the same thing.  The user typed "help" and you help him.  If
> the user types "show tables", you show him the tables.  If the user
> typed "show tables" and you send him a help message, that is not what
> the user wanted.

If what the user wanted was to be using MySQL, he is out of luck anyway.

I'm actually no big advocate of the \d commands. They're basically
magical queries that you can't easily see or edit - I've more than
once wished for a WHERE clause (\df WHERE "Result data type" =
'internal' or what have you. But I don't have a practical solution
for dealing with that problem, and I think trying to emulate MySQL is
probably not a good idea... what if we wanted to make "USE" actually
mean something some day? If it just prints out a helpful error
message, that could still be possible (and we lose the helpful error
message), but if people are expecting it to work, we're hosed.

...Robert


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 15:00:05
Message-ID: 4B571A75.7090105@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> I'm actually no big advocate of the \d commands. They're basically
> magical queries that you can't easily see or edit - I've more than
> once wished for a WHERE clause (\df WHERE "Result data type" =
> 'internal' or what have you.
>

You *can* easily see them, at least. Run "psql -E" or inside psql do
"\set ECHO_HIDDEN"

cheers

andrew


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 15:11:11
Message-ID: 873a20erqo.fsf@hi-media-techno.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> If what the user wanted was to be using MySQL, he is out of luck
> anyway.

That's not what we're talking about. We're talking about having a nice
client tool for those people having to do both MySQL and PostgreSQL
support, or new to PostgreSQL and comming from MySQL.

I'll give my vote to Peter's idea that show tables; should better act as
if you typed \d.

I don't see what the gain is to refuse being nice to MySQL newcomers
when someone actually does the work. If the USE keyword is one we want
to keep free for our own usage, let just skip that compat option.

> I'm actually no big advocate of the \d commands. They're basically
> magical queries that you can't easily see or edit

We already have the psql \set ECHO_HIDDEN command to easily see the
query, then it's a copy/paste away. I'd propose to have this setting
also make it so that the query it runs is placed in the buffer for next
\e command, which is not the case in 8.4.

Regards,
--
dim


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, David Christensen <david(at)endpoint(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 15:19:38
Message-ID: 201001201519.o0KFJcf26122@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dimitri Fontaine wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > If what the user wanted was to be using MySQL, he is out of luck
> > anyway.
>
> That's not what we're talking about. We're talking about having a nice
> client tool for those people having to do both MySQL and PostgreSQL
> support, or new to PostgreSQL and comming from MySQL.
>
> I'll give my vote to Peter's idea that show tables; should better act as
> if you typed \d.
>
> I don't see what the gain is to refuse being nice to MySQL newcomers
> when someone actually does the work. If the USE keyword is one we want
> to keep free for our own usage, let just skip that compat option.

I think the problem is that many other MySQL commands will not work or
be supported, and if you give the person the desired output _and_ a
suggestion to use \d, the suggests is easily overlooked.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Dimitri Fontaine" <dfontaine(at)hi-media(dot)com>
Cc: "David Christensen" <david(at)endpoint(dot)com>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Magnus Hagander" <magnus(at)hagander(dot)net>, "Jeff Davis" <pgsql(at)j-davis(dot)com>, "Stefan Kaltenbrunner" <stefan(at)kaltenbrunner(dot)cc>, "Bruce Momjian" <bruce(at)momjian(dot)us>, <pgsql-hackers(at)postgresql(dot)org>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 15:30:03
Message-ID: 4B56CD1B020000250002E866@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dimitri Fontaine <dfontaine(at)hi-media(dot)com> wrote:

> I'll give my vote to Peter's idea that show tables; should better
> act as if you typed \d.

I guess we don't need a "tables" GUC. Show all wouldn't include it?
Would we require a semicolon? Do we support \d-style globs?

Still seems kinda messy. +1 for help to show the PostgreSQL command
as a guess for what they want to do. -1 for MySQL emulation.

-Kevin


From: Gabriele Bartolini <gabriele(dot)bartolini(at)2ndquadrant(dot)it>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, David Christensen <david(at)endpoint(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Jeff Davis <pgsql(at)j-davis(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Bruce Momjian <bruce(at)momjian(dot)us>, "<pgsql-hackers(at)postgresql(dot)org>" <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 15:38:04
Message-ID: D9FFED7B-FE70-4D95-BDC5-E0465D2D07EC@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I would personally emulate \d and take the chance for showing a funny
warning, something like: "hey, it's not MySql!" or similar. I am sure
we will Finder something appropriate. :)

Inviato da iPhone

Il giorno 20/gen/2010, alle ore 16.30, "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov
> ha scritto:

> Dimitri Fontaine <dfontaine(at)hi-media(dot)com> wrote:
>
>> I'll give my vote to Peter's idea that show tables; should better
>> act as if you typed \d.
>
> I guess we don't need a "tables" GUC. Show all wouldn't include it?
> Would we require a semicolon? Do we support \d-style globs?
>
> Still seems kinda messy. +1 for help to show the PostgreSQL command
> as a guess for what they want to do. -1 for MySQL emulation.
>
> -Kevin
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 16:53:35
Message-ID: 14389.1264006415@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dimitri Fontaine <dfontaine(at)hi-media(dot)com> writes:
> I'll give my vote to Peter's idea that show tables; should better act as
> if you typed \d.

We have previously considered and rejected this type of approach, for
example in the pgsql-bugs discussion I referenced upthread.

> I don't see what the gain is to refuse being nice to MySQL newcomers
> when someone actually does the work.

Nobody has actually done such work, nor offered to. If it did show up
it would be a large and ugly patch that would have a good chance of
being rejected. The proposed patch to just provide a helpful message
is only a dozen or two lines, which is about the right amount of effort
to expend in this direction IMHO.

regards, tom lane


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, David Christensen <david(at)endpoint(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-20 16:59:28
Message-ID: 87zl48btlb.fsf@hi-media-techno.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> The proposed patch to just provide a helpful message
> is only a dozen or two lines, which is about the right amount of effort
> to expend in this direction IMHO.

For the record, agreed on the commands for which we have no obvious
equivalent :)

Regards,
--
Dimitri Fontaine
PostgreSQL DBA, Architecte


From: Florian Weimer <fweimer(at)bfk(dot)de>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-21 17:48:18
Message-ID: 827hrbfixp.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* David Christensen:

> Currently, a session will look like the following:
>
> machack:machack:5485=# show tables;
> See:
> \d
> or \? for general help with psql commands
> machack:machack:5485=#
>
> Said formatting looks like it could use some improvement, open to
> suggestions, but something on a single line seems more useful.

You should at least make clear that this is an error message due to an
unsupported command. The output above looks broken. Something like
this should be okay, I think:

ERROR: unrecognized configuration parameter "tables"
NOTICE: use \d to list tables, or \? for general help with psql commands

ERROR: unrecognized configuration parameter "databases"
NOTICE: use \l to list databases, or \? for general help with psql commands

(I hope that this is less controversial, too.)

--
Florian Weimer <fweimer(at)bfk(dot)de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99


From: David Christensen <david(at)endpoint(dot)com>
To: Florian Weimer <fweimer(at)bfk(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-21 17:58:25
Message-ID: F4C187DC-3609-4204-B347-8B4A9856604B@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 21, 2010, at 11:48 AM, Florian Weimer wrote:

> * David Christensen:
>
>> Currently, a session will look like the following:
>>
>> machack:machack:5485=# show tables;
>> See:
>> \d
>> or \? for general help with psql commands
>> machack:machack:5485=#
>>
>> Said formatting looks like it could use some improvement, open to
>> suggestions, but something on a single line seems more useful.
>
> You should at least make clear that this is an error message due to an
> unsupported command. The output above looks broken. Something like
> this should be okay, I think:
>
> ERROR: unrecognized configuration parameter "tables"
> NOTICE: use \d to list tables, or \? for general help with psql
> commands
>
> ERROR: unrecognized configuration parameter "databases"
> NOTICE: use \l to list databases, or \? for general help with psql
> commands

That's a very good point as far as the visibility is concerned.
Should the error messages between the SHOW cases and the others be
consistent ("ERROR: unsupported command" or similar)? It's worth
noting that this is only in the psql client, but we could simulate the
ereport output from the server.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Florian Weimer <fweimer(at)bfk(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-21 18:01:30
Message-ID: 162867791001211001s3883aab5va969d3b30fd04bf6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/1/21 David Christensen <david(at)endpoint(dot)com>:
>
> On Jan 21, 2010, at 11:48 AM, Florian Weimer wrote:
>
>> * David Christensen:
>>
>>> Currently, a session will look like the following:
>>>
>>>  machack:machack:5485=# show tables;
>>>  See:
>>>        \d
>>>        or \? for general help with psql commands
>>>  machack:machack:5485=#
>>>
>>> Said formatting looks like it could use some improvement, open to
>>> suggestions, but something on a single line seems more useful.
>>
>> You should at least make clear that this is an error message due to an
>> unsupported command.  The output above looks broken.  Something like
>> this should be okay, I think:
>>
>> ERROR:  unrecognized configuration parameter "tables"
>> NOTICE: use \d to list tables, or \? for general help with psql commands
>>
>> ERROR:  unrecognized configuration parameter "databases"
>> NOTICE: use \l to list databases, or \? for general help with psql
>> commands
>
>
> That's a very good point as far as the visibility is concerned.  Should the
> error messages between the SHOW cases and the others be consistent ("ERROR:
> unsupported command" or similar)?  It's worth noting that this is only in
> the psql client, but we could simulate the ereport output from the server.

I don't think so it is the best idea. I like different message types,
because I able to identify place of error. If it is server or client
error.

Pavel

>
> Regards,
>
> David
> --
> David Christensen
> End Point Corporation
> david(at)endpoint(dot)com
>
>
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Florian Weimer <fweimer(at)bfk(dot)de>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-21 18:02:28
Message-ID: 10968.1264096948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Christensen <david(at)endpoint(dot)com> writes:
> Should the error messages between the SHOW cases and the others be
> consistent ("ERROR: unsupported command" or similar)? It's worth
> noting that this is only in the psql client, but we could simulate the
> ereport output from the server.

No. Not unless you want to simulate it to the point of honoring the
different verbosity settings, which would greatly expand the size of the
patch. We do not try to make the response to "help" look like an error
message, and I don't see the value of doing so here either.

(I think Florian's real problem with the proposed output is that it's
ugly, which I agree with --- the formatting is strange.)

regards, tom lane


From: David Christensen <david(at)endpoint(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Florian Weimer <fweimer(at)bfk(dot)de>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: MySQL-ism help patch for psql
Date: 2010-01-21 18:06:18
Message-ID: 6A407045-6E82-4B9D-BF96-A5C734F2C2CD@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Jan 21, 2010, at 12:02 PM, Tom Lane wrote:

> David Christensen <david(at)endpoint(dot)com> writes:
>> Should the error messages between the SHOW cases and the others be
>> consistent ("ERROR: unsupported command" or similar)? It's worth
>> noting that this is only in the psql client, but we could simulate
>> the
>> ereport output from the server.
>
> No. Not unless you want to simulate it to the point of honoring the
> different verbosity settings, which would greatly expand the size of
> the
> patch. We do not try to make the response to "help" look like an
> error
> message, and I don't see the value of doing so here either.
>
> (I think Florian's real problem with the proposed output is that it's
> ugly, which I agree with --- the formatting is strange.)

I'm with you on that one; I tried to address that in the second
revision of the patch. But I'm definitely open to suggestions.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com