Re: Re: PostreSQL SQL for MySQL SQL
От | Chuck Esterbrook |
---|---|
Тема | Re: Re: PostreSQL SQL for MySQL SQL |
Дата | |
Msg-id | 5.0.2.1.0.20010206142004.021b2090@mail.mindspring.com обсуждение исходный текст |
Ответ на | Re: Re: PostreSQL SQL for MySQL SQL (John Burski <John.Burski@911ep.com>) |
Ответы |
clean rebuild process?
Re: Re: PostreSQL SQL for MySQL SQL |
Список | 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
В списке pgsql-general по дате отправления: