Re: Moving from MySQL to PGSQL....some questions - Mailing list pgsql-general

From Michael Chaney
Subject Re: Moving from MySQL to PGSQL....some questions
Date
Msg-id 20040225164050.GC6206@michaelchaney.com
Whole thread Raw
In response to Moving from MySQL to PGSQL....some questions  (Karam Chand <karam_chand03@yahoo.com>)
List pgsql-general
On Wed, Feb 25, 2004 at 06:57:04AM -0800, Karam Chand wrote:
> 4.) I couldnot find any query to change the context of
> database like in MySQL :
>
> use database;

Your other questions were answered more than adequately by others, but I
thought I'd provide more details here.

If you're in the command line psql, then use "\c database" to accomplish
this.  The drawback is that you cannot change the database in that
manner programmatically.  If you're using Perl or PHP, for instance, you
must connect to the other database explicitly using the proper function.
In Perl, this means you must use DBI->connect again with the new
database name.

In MySQL, you can get data from another database by using the construct
"datbase.table" to refer to the table.  This doesn't work in Postgres.

If you need to do something like that, you likely need to be using
schemas.

I've put together a quick list of minor differences between MySQL and
Postgres (besides the obvious "real RDBMS" features that exist only in
Postgres) that should help you get started:

http://www.michaelchaney.com/mysql-to-postgres.html

That includes information on date handling, literal quoting, basically
anything that I ran in to while converting an application.  But it
should help you get started quickly.

Michael
--
Michael Darrin Chaney
mdchaney@michaelchaney.com
http://www.michaelchaney.com/

pgsql-general by date:

Previous
From: Jean-Michel POURE
Date:
Subject: Re: Moving from MySQL to PGSQL....some questions
Next
From: Bill Moran
Date:
Subject: Re: Moving from MySQL to PGSQL....some questions