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

From Ross J. Reedstrom
Subject Re: OID from insert has extra letter
Date
Msg-id 20010206183938.A22628@rice.edu
Whole thread Raw
In response to Re: OID from insert has extra letter  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-hackers
On Tue, Feb 06, 2001 at 06:17:46PM -0600, Ross J. Reedstrom wrote:
> 
> Seems it's a non-portable behavior:
> 
>       The  strncpy()  function  is similar, except that not more
>        than n bytes of src are copied. Thus, if there is no  null
>        byte among the first n bytes of src, the result wil not be
>        null-terminated.
> 
>        In the case where the length of src is less than  that  of
>        n, the remainder of dest will be padded with nulls.
> 
> I've already forgotten what platform the original bug report came from.

Just checked, D'Arcy never told us. But it doesn't matter, the manpage
lies.  I just tested it with a tiny little program that copies two
different constant strings into a buffer. Nothing get's padded with nulls,
as Tom knew. Once again, experience trumps book knowledge. (Checking
a couple random examples from my own code, I seem to have lucked out:
I've a habit of zeroing my buffers myself)

Ross


pgsql-hackers by date:

Previous
From: Lamar Owen
Date:
Subject: Re: Include files for SPI are not installed
Next
From: Tom Lane
Date:
Subject: Re: Re: [SQL] PL/PGSQL function with parameters