Thanks to visit codestin.com
Credit goes to postgrespro.com

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 [email protected]
Whole thread Raw
In response to Re: OID from insert has extra letter  ("Ross J. Reedstrom" <[email protected]>)
List pgsql-hackers
"Ross J. Reedstrom" <[email protected]> writes:
> Seems it's a non-portable behavior:

Not at all.  The code is asking strncpy to copy n bytes, where n is
known to be <= strlen of the source string.  Every spec-conforming
implementation of strncpy will copy n bytes, no more, no less, and
will *not* add a trailing null after them.  The only reason the code
appeared to work is that it was dealing with a static buffer that
starts out all zeroes, so the trailing null was already in place.
Until the buffer had been used for a longer OID, that is.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Include files for SPI are not installed
Next
From: Bruce Momjian
Date:
Subject: Re: Duplicate OIDs in pg_attribute