Re: Incorrect format in error message

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Incorrect format in error message
Date: 2016-04-01 07:03:31
Message-ID: CAKJS1f_3jbCBtsVY10py20jPCGP9NowYoQTXFxzdsP4OFcSRFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1 April 2016 at 17:30, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
>> The attached fixes an error message which is incorrectly using an
>> unsigned format specifier instead of a signed one.
>
> I think that's the tip of the iceberg :-(. For starters, the code
> allows ObjectIdAttributeNumber without regard for the fact that the
> next line will dump core on a negative attno. Really though, what
> astonishes me about this example is that we allow indexes at all on
> system columns other than OID. None of the other ones can possibly
> have either a use-case or sensible semantics, can they? We certainly
> would not stop to update indexes after changing xmax, for example.

ouch. Yeah that's not going to work very well. I guess nobody's tried
that with a unique index on an OID column yet then.

I've changed the patch around a little to fix the crash. I was a bit
worried as logical decoding obviously has not yet been tested with an
OID unique index as the replica indentity, so I gave it a quick test
to try to give myself a little piece of mind that this won't uncover
something else;

# create table t (a int) with oids;
CREATE TABLE
# create unique index t_oid_idx on t(oid);
CREATE INDEX
# alter table t replica identity using index t_oid_idx;
ALTER TABLE
# insert into t values(123);
INSERT 24593 1
# delete from t;

On the receive side:

BEGIN 606
table public.t: INSERT: oid[oid]:24593 a[integer]:123
COMMIT 606
BEGIN 607
table public.t: DELETE: oid[oid]:24593
COMMIT 607

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
replica_identity_crash_fix.patch application/octet-stream 5.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-04-01 07:04:32 Re: Speedup twophase transactions
Previous Message Andres Freund 2016-04-01 06:52:17 Re: Timeline following for logical slots