Home > Archive > PostgreSQL Bugs > June 2005 > BUG #1715: dbmirror replaces nextval, setval functions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author BUG #1715: dbmirror replaces nextval, setval functions
James Doherty

2005-06-10, 11:24 am


The following bug has been logged online:

Bug reference: 1715
Logged by: James Doherty
Email address: jdoherty@yak.ca
PostgreSQL version: 8.0.3
Operating system: Solaris 8 Intel
Description: dbmirror replaces nextval, setval functions
Details:

The dbmirror contrib program replaces some key functions when setting up the
Mirroring table (MirrorSetup.sql). The nextval and setval functions are
renamed as nextval_pg and setval_pg and replaced with new functions.

This breaks any fields made with the SERIAL datatype, which have to be
ALTER'ed to use the nextval_pg and setval_pg functions to work properly.


Here's the offending code in MirrorSetup.sql:
UPDATE pg_proc SET proname='nextval_pg'
WHERE proname='nextval';

CREATE FUNCTION pg_catalog.nextval(text) RETURNS int8 AS
'$libdir/pending.so', 'nextval' LANGUAGE 'C' STRICT;


UPDATE pg_proc set proname='setval_pg' WHERE proname='setval';

CREATE FUNCTION pg_catalog.setval("unknown",integer,boolean) RETURNS int8
AS
'$libdir/pending.so', 'setval' LANGUAGE 'C' STRICT;
CREATE FUNCTION pg_catalog.setval("unknown",integer) RETURNS int8 AS
'$libdir/pending.so', 'setval' LANGUAGE 'C' STRICT;

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org

Achilleus Mantzios

2005-06-13, 3:24 am

O James Doherty έγραψε στις Jun 10, 2005 :

>
> The following bug has been logged online:
>
> Bug reference: 1715
> Logged by: James Doherty
> Email address: jdoherty@yak.ca
> PostgreSQL version: 8.0.3
> Operating system: Solaris 8 Intel
> Description: dbmirror replaces nextval, setval functions
> Details:
>
> The dbmirror contrib program replaces some key functions when setting up the
> Mirroring table (MirrorSetup.sql). The nextval and setval functions are
> renamed as nextval_pg and setval_pg and replaced with new functions.
>
> This breaks any fields made with the SERIAL datatype, which have to be
> ALTER'ed to use the nextval_pg and setval_pg functions to work properly.
>
>
> Here's the offending code in MirrorSetup.sql:
> UPDATE pg_proc SET proname='nextval_pg'
WHERE proname='nextval';
>
> CREATE FUNCTION pg_catalog.nextval(text) RETURNS int8 AS
> '$libdir/pending.so', 'nextval' LANGUAGE 'C' STRICT;
>
>
> UPDATE pg_proc set proname='setval_pg' WHERE proname='setval';
>
> CREATE FUNCTION pg_catalog.setval("unknown",integer,boolean) RETURNS int8
> AS
> '$libdir/pending.so', 'setval' LANGUAGE 'C' STRICT;
> CREATE FUNCTION pg_catalog.setval("unknown",integer) RETURNS int8 AS
> '$libdir/pending.so', 'setval' LANGUAGE 'C' STRICT;


You are right, since dbmirror mirrors tables based on whether
the recordchange trigger is present, whereas it seems
to mirror sequences unconditionally.

You could rename dbmirror's setval,nextval to
dbmirror_setval,dbmi
rror_nextval, and leave
postgresql's original functions as is.

Just a note tho:
Dbmirror is a great tool, but someone needs to hack a great deal
of code to meet his/her special requirements.

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org
>


--
-Achilleus


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com