Hassan Schroeder <hassan(dot)schroeder(at)gmail(dot)com> writes:
> On Tue, Oct 13, 2009 at 2:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Note that practically all clients do offer that functionality easily
>> --- for instance, in psql it's "\c databasename". But without knowing
>> what client code you're using it's hard to offer advice.
> Thanks, that's what I was looking for. And yes, my bad for not
> specifying I was using 'psql' -- didn't realize there was more than
> one command-line interface. (Are those listed anywhere?)
Not sure there is more than one, but there are certainly GUI clients,
such as pgAdmin.
>> Also, as Richard noted, mysql's "databases" are really closer to pgsql's
> Sorry, can you expand on that, or give me a pointer to an explanation?
> If a pgsql schema is the equivalent of a mysql database, what's a pgsql
> "database"? Why would you choose one over the other?
AFAIK mysql doesn't have anything that directly corresponds to a PG
database. In PG, a database is a separate set of system catalogs.
There is some infrastructure it shares with other databases in the
same installation, but not much. If you have a table in one database,
it is simply not possible to get at it while connected to a different
database. This is unlike schemas, which are just a naming hierarchy.
If you're accustomed to doing "select * from foo.bar" to get at a
table named bar in a mysql database named foo, you'd want to handle
that in PG by setting up a schema named foo. So in that context,
"USE something" corresponds to "SET search_path = something", just
as Richard suggested.
Usually you'd use a separate database for an application or user
that you want to keep pretty well insulated from others.
regards, tom lane
In response to
pgsql-novice by date
|Next:||From: Tom Lane||Date: 2009-10-13 22:40:41|
|Subject: Re: mysql command equivalents? |
|Previous:||From: Thom Brown||Date: 2009-10-13 22:20:18|
|Subject: Re: mysql command equivalents?|