![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
I'm trying to get some code to run with PostgreSQL after succesfully getting it to run with MySQL and Sqlite, |
|
and if I had known Postgres was going to be such as pain in the butt, I would've refused. The current problem is that obvious call PQoidValue() doesn't work. The solution apparently is that currval(sequencename), which is just nifty except the INSERT statement doesn't say which field that is. Instead have I have to parse out the table name and then look up in my own schema definitions for which field that is. (Even though apparently I could get it in 5 to 10 queries if there was a clearly documented explanation of how to SERIAL fields are scattered amongst those pg_% tables. The again I gave up trying to extract primary and unique constraints to recreate the simple functionality of SHOW CREATE TABLE.) And of course I have to construct a whole separate query just to get one piece of information that the library should've already known since it's one of the most obvious questions to be asked after an INSERT. Fuck. |
|
So why does PostgreSQL suck? It's not that some people decided they could make a better wheel than anyone else. Maybe they could. But if I can't fit that wheel on the existing waggon, it's useless pile of crap. It has got to |
|
be obvious by this time that going from something like Sqlite to PostgreSQL is going to be a bloody pain in the butt because Postgres is so pure and blessed and above the other databases that they cannot be botherred to provide an interface that allows a programmer to use standard query language and adapt an existing library interface that behaves in a similar fashion for every database. I have learned too late that what I really need to do is define a standard query language so that I can write the bulk of my code independent of the databases. Then write a per-database translator from the standard query language to the specific SQL of each database. And yes I know what the S of SQL stands for, it's a lie and very poor joke. One thing I've already learned is not depend on pg_% tables to discover the schema, but to retain the schema definition I used to create the database and parse that. |
#3
| |||
| |||
|
|
It's not that some people decided they could make a better wheel than anyone else. Maybe they could. But if I can't fit that wheel on the existing waggon, it's useless pile of crap. |
|
I have learned too late that what I really need to do is define a standard query language so that I can write the bulk of my code independent of the databases. |
|
And yes I know what the S of SQL stands for, it's a lie and very poor joke. |
![]() |
| Thread Tools | |
| Display Modes | |
| |