Re: [GENERAL] Connect without specifying a database?

2009-04-12 Thread Alban Hertroys
On Apr 11, 2009, at 6:10 PM, li...@mgreg.com wrote: What do you mean when you say the catalogs...are database- specific ? If I'm understanding what you're saying, my whole point is that I don't want to be tied to a database to do any kind of querying about the PG engine itself. Does that

[GENERAL] Connect without specifying a database?

2009-04-11 Thread li...@mgreg.com
Hi All, Quick question: Does PGSQL provide a mechanism by which to connect to the server without specifying a database? I saw a thread back in 2005 that said no (http://archives.postgresql.org//pgsql-interfaces/2005-02/msg00031.php ), but I was curious as to whether that's changed.

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Sam Mason
On Sat, Apr 11, 2009 at 11:30:00AM -0400, li...@mgreg.com wrote: Quick question: Does PGSQL provide a mechanism by which to connect to the server without specifying a database? I saw a thread back in 2005 that said no

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Raymond O'Donnell
On 11/04/2009 16:30, li...@mgreg.com wrote: Quick question: Does PGSQL provide a mechanism by which to connect to the server without specifying a database? I saw a thread back in 2005 that said no (http://archives.postgresql.org//pgsql-interfaces/2005-02/msg00031.php), but I was curious as

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread li...@mgreg.com
On Apr 11, 2009, at 11:39 AM, Raymond O'Donnell wrote: The answer is still no. :-) The usual thing it to connect to the postgres database (or to template1 in older versions of PG), and then you can issue queries to see what's there. You're pretty much guaranteed that one of those databases

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Tom Lane
li...@mgreg.com li...@mgreg.com writes: Hrm...Ok, well, for the record, I'm moving some systems from MySQL to Postgres and am in the process of getting familiar with it. I was hoping there were some higher level management items like show databases, and show tables, etc in Postgres as

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Sam Mason
On Sat, Apr 11, 2009 at 11:49:25AM -0400, li...@mgreg.com wrote: I was hoping there were some higher level management items like show databases, and show tables, etc in Postgres as well. The standard way would be to use the information_schema, it's in the SQL standard and supported by more

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Ries van Twisk
On Apr 11, 2009, at 10:49 AM, li...@mgreg.com wrote: On Apr 11, 2009, at 11:39 AM, Raymond O'Donnell wrote: The answer is still no. :-) The usual thing it to connect to the postgres database (or to template1 in older versions of PG), and then you can issue queries to see what's there.

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread li...@mgreg.com
On Apr 11, 2009, at 11:56 AM, Tom Lane wrote: There are, although we don't spell the commands like that. This is not relevant to the question of whether it makes sense to connect without being connected to a specific database. It doesn't, because the catalogs that you have to inspect to

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Adrian Klaver
On Saturday 11 April 2009 9:10:33 am li...@mgreg.com wrote: On Apr 11, 2009, at 11:56 AM, Tom Lane wrote: There are, although we don't spell the commands like that. This is not relevant to the question of whether it makes sense to connect without being connected to a specific database.

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Tom Lane
li...@mgreg.com li...@mgreg.com writes: What do you mean when you say the catalogs...are database- specific ? If I'm understanding what you're saying, my whole point is that I don't want to be tied to a database to do any kind of querying about the PG engine itself. Does that make

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread John R Pierce
li...@mgreg.com wrote: I'm sorry, I'm confused by your reply. I may have said table when I meant database. I believe it absolutely *does* make sense to connect without specifying a database first. What if you hit that edge case where there are in fact no databases? I suppose you could

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Tom Lane
[ forgot to respond to this bit... ] li...@mgreg.com li...@mgreg.com writes: What if you hit that edge case where there are in fact no databases? There is no such edge case. DROP DATABASE has to be issued while connected to some database, and it won't let you drop the DB you're connected to.

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread li...@mgreg.com
On Apr 11, 2009, at 12:56 PM, Tom Lane wrote: There is no such edge case. DROP DATABASE has to be issued while connected to some database, and it won't let you drop the DB you're connected to. And CREATE DATABASE has to be issued while connected to some database, so createdb still has to

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Adrian Klaver
On Saturday 11 April 2009 10:15:44 am li...@mgreg.com wrote: On Apr 11, 2009, at 12:56 PM, Tom Lane wrote: There is no such edge case. DROP DATABASE has to be issued while connected to some database, and it won't let you drop the DB you're connected to. And CREATE DATABASE has to be

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Christophe
On Apr 11, 2009, at 10:15 AM, li...@mgreg.com wrote: So, how does needing to connect to a database before querying about existing databases make any sense? Well, you have to connect to the database server, no matter what, in order to check on the existence of a database (unless you are

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Sam Mason
On Sat, Apr 11, 2009 at 01:15:44PM -0400, li...@mgreg.com wrote: On Apr 11, 2009, at 12:56 PM, Tom Lane wrote: There is no such edge case. DROP DATABASE has to be issued while connected to some database, and it won't let you drop the DB you're connected to. And CREATE DATABASE has to

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread li...@mgreg.com
On Apr 11, 2009, at 1:49 PM, Sam Mason wrote: As others have said; the design of PG is such that it's built to assume you're always connected to exactly one database. I'd guess this is an artifact from a long time ago when PG didn't have multiple databases. -- Sam http://samason.me.uk/

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Tom Lane
Sam Mason s...@samason.me.uk writes: As others have said; the design of PG is such that it's built to assume you're always connected to exactly one database. I'd guess this is an artifact from a long time ago when PG didn't have multiple databases. It's possible that that was true way back in