From: | Chuck Esterbrook <echuck(at)mindspring(dot)com> |
---|---|
To: | John Burski <John(dot)Burski(at)911ep(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Re: PostreSQL SQL for MySQL SQL |
Date: | 2001-02-06 19:24:08 |
Message-ID: | 5.0.2.1.0.20010206142004.021b2090@mail.mindspring.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
At 01:10 PM 2/6/2001 -0600, John Burski wrote:
>There is no "if exists" functionality in PostgreSQL. However, you could
>probably create your own "if exists" type of functionality. I've found
>that it's not really necessary. I access my databases either
>interactively, via psql, via the Perl Pg module, or via PHP. If you
>attempt to drop a database that doesn't exist, PostgreSQL will issue an
>error message. If you're running interactively, you'll see the message;
>if you're accessing via a Perl module or PHP, you can check the query
>results to see if an error occurred. I'm fairly certain that this same
>mechanism exists if you're using C or C++ to access your databases.
I'd prefer to skip the error message, because otherwise my regression test
suite will barf, saying something like "Test X failed due to SQL error". I
suppose I work in some code to catch this and swallow it.
>I'm not familiar with the "use Foo" functionality of MySQL, so I can't
>discuss it.
I think you may have answered it with your "\connect dbname" comment.
Provided that I can put that after the "create database" in the SQL script
and feed the whole mess to psql.
I'll give this stuff a try. Thanks to all who answered.
I think it's still a good idea to provided the "if exists" clause in a
future PostgreSQL version for these reasons:
1. it's convenient
2. it doesn't interfere with existing functionality or performance
3. it makes porting from MySQL to PostgreSQL easier
-Chuck
From | Date | Subject | |
---|---|---|---|
Next Message | chris markiewicz | 2001-02-06 20:02:48 | clean rebuild process? |
Previous Message | Matthew | 2001-02-06 19:15:04 | RE: Re: startup Postgres on NT |