Re: Sequences in DB/pgsql (once again)
| From: | Stig S. Bakken | Date: | Thu, 14 Dec 2000 12:04:30 +0000 |
| Subject: | Re: Sequences in DB/pgsql (once again) | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-692@lists.php.net to get a copy of this message | ||
Alexey Borzov wrote:
>
> Greetings!
>
> Well, I made an update of PEAR and found sequence implementation...
> First of all, I honestly don't think that
>
> if ($ondemand && DB::isError($result) &&
> $result->getMessage() == "DB Error: ERROR: db_seq_test.nextval: sequence does not
> exist\n") {
>
> is the intended behaviour... ;]
> Relying on error messages' format is probably a Bad Thing itself...
I know, consider it a temporary hack. :-) Anyway, as we run the pgsql
regression tests on different postgres versions, we'll find out what
works and not.
I'm thinking of addressing postgres error mapping (so we can use DB's
DB_ERROR_BLAH error codes for things like these) by regular expression
matching on pg_errormessage() output. There are really no other ways to
do it as far as I can see. Again, the implementation will be supported
by regression tests so we can verify that it works in different postgres
versions.
> As for 'db_seq_{$seq_name}' - I don't think that prepending *anything* to
> table (or sequence) name is good. The reasons are simple -
> prefixes are usually used for hiding something or grouping (if a table
> name begins with 'pg_' in Postgres - it is a system table, if it
> begins with 'pga_' - it is a PgAccess table and is not shown in
> PgAccess). Besides, 'db_' prefix is misleading.
I don't have any strong feelings about this, the reason I chose
"db_seq_" was to indicate that "this is a sequence created by DB". As
long as it is possible, I would like to see a consistent naming scheme
for all databases, what it actually ends up being is less important.
"_seq" suffix is fine with me. :-)
- Stig