Re: Moving from MySQL to PGSQL....some questions

From: Michael Chaney <mdchaney(at)michaelchaney(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Moving from MySQL to PGSQL....some questions
Date: 2004-02-25 16:40:50
Message-ID: 20040225164050.GC6206@michaelchaney.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)michaelchaney(dot)com
http://www.michaelchaney.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-02-25 16:48:58 Re: invalid memory alloc request size
Previous Message Bill Moran 2004-02-25 16:38:02 Re: Moving from MySQL to PGSQL....some questions