Re: OID from insert has extra letter

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: OID from insert has extra letter
Date: 2001-02-07 00:39:38
Message-ID: 20010206183938.A22628@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-07 00:43:10 Re: Re: [SQL] PL/PGSQL function with parameters
Previous Message Lamar Owen 2001-02-07 00:34:46 Re: Include files for SPI are not installed