This should really be fixed in code, not turned back on in the database (which some users may not be able to do anyway).
From the postgres manual ( http://www.postgresql.org/docs/8.1/interactive/runtime-config-compatible.ht ml#GUC-DEFAULT-WITH-OIDS):
Quote: |
The use of OIDs in user tables is considered deprecated
|
While some would argue that using lastval() to get the last value of a serial field is error prone and the proper way to set an id is to call nextval() on the sequence *before* doing the insert and including the id in the insert itself, the way FUDforum is written doesn't allow easy modification to work that way.
So, an easy fix is to locate all lines of code that get the last id created by querying the database using the oid from pg_last_oid() and wrapping this bit of code around it:
if (pg_last_oid($r)) {
<<old return statement>>
}
else {
return q_singleval('SELECT lastval()');
}
So, for example, function db_qid() would be changed from this:
function db_qid($q)
{
$r = q($q);
preg_match('!('.$GLOBALS['DBHOST_TBL_PREFIX'].'[A-Za-z0-9_]+)!', $q, $m);
return q_singleval('SELECT id FROM '.$m[1].' WHERE oid='.pg_last_oid($r));
}
to this:
function db_qid($q)
{
$r = q($q);
preg_match('!('.$GLOBALS['DBHOST_TBL_PREFIX'].'[A-Za-z0-9_]+)!', $q, $m);
if (pg_last_oid($r)) {
return q_singleval('SELECT id FROM '.$m[1].' WHERE oid='.pg_last_oid($r));
}
else {
return q_singleval('SELECT lastval()');
}
}
From what I found, there are two functions that need this change -- db_qid() and db_li() -- that are replicated in six files:
<fud_web>/index.php
<fud_web>/pdf.php
<fud_web>/rdf.php
<fud_data>/include/theme/default/db.inc
<fud_data>/sql/pgsql/db.inc
<fud_data>/src/db.inc.t
---Lawrence