Re: Fix inappropriate uses of atol()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix inappropriate uses of atol()
Date: 2024-08-03 16:05:59
Message-ID: 4176051.1722701159@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> I'm actually not even sure if it's intentional to throw the error even
> with "char[1]". It makes sense to give an error on "char", but who says
> that "char[1]" isn't a valid string?

I agree that that behavior looks more like an implementation artifact
than anything else.

> If we can easily distinguish between "char" and any array of char here,
> might be best to accept the all arrays regardless of the length.

The data structure is so poorly documented that I'm hesitant to try
to do that. It might work to test for type == ECPGt_array, but then
why is the immediately following code explicitly allowing for both
that case and not-array? I'm also fairly unsure how ECPGt_string
fits in here. If this were an important point then it might be
worth trying to reverse-engineer all this, but right now I have
better things to do.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2024-08-03 18:50:14 Re: pg_dump: optimize dumpFunc()
Previous Message Michael Paquier 2024-08-03 16:02:22 Re: Injection points: preloading and runtime arguments