Re: mysql command equivalents?
От | Tom Lane |
---|---|
Тема | Re: mysql command equivalents? |
Дата | |
Msg-id | 20719.1255472715@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | mysql command equivalents? (Hassan Schroeder <hassan.schroeder@gmail.com>) |
Список | pgsql-novice |
Hassan Schroeder <hassan.schroeder@gmail.com> writes: > On Tue, Oct 13, 2009 at 2:50 PM, Tom Lane <tgl@sss.pgh.pa.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 >> "schemas". > 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
В списке pgsql-novice по дате отправления: