Re: OID from insert has extra letter - Mailing list pgsql-hackers

From Tom Lane
Subject Re: OID from insert has extra letter
Date
Msg-id 26434.981504500@sss.pgh.pa.us
Whole thread Raw
In response to Re: OID from insert has extra letter  (ncm@zembu.com (Nathan Myers))
Responses Re: OID from insert has extra letter  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-hackers
ncm@zembu.com (Nathan Myers) writes:
> Thus, the original code is OK, except probably the literal "23"
> in place of what should be a meaningful symbolic constant, or
> (at least!) sizeof(buf) - 1.

No, the original code is NOT ok.  Read the man page again.  As the
code stood, the only null that ever got written to the buffer was the
one installed in buf[23].  The only reason it appeared to work at all
was that buf would start out all zeroes --- but after one or more uses
it's not all zeroes anymore.  See the bug report that started the
thread ...

> BTW, that static buffer in PGoidStatus is likely to upset threaded 
> client code...

Yeah, we know.  The routine is deprecated now because of that.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: a contrib function to query current locale values
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: OID from insert has extra letter