libpq: PQfnumber overload for not null-terminated strings

From: Ivan Trofimov <i(dot)trofimow(at)yandex(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: libpq: PQfnumber overload for not null-terminated strings
Date: 2024-02-25 11:33:01
Message-ID: dd771e4c-1ec8-e145-fdff-a6e08f543831@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

This one comes from C++'s `std::string_view`: being just a `const char*`
plus the `size`, it's a very convenient type to use in interfaces which
don't need an ownership of the data passed in.

Unfortunately, `PQfnumber` expects a null-terminated string, which
`std::string_view` can not guarantee, and this limitations affects the
interfaces built on top of libpq.

Would you be willing to review a patch that adds an `PQfnumber` overload
that takes a `field_name` size as well?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2024-02-25 12:48:59 Re: RangeTblEntry jumble omissions
Previous Message Julien Rouhaud 2024-02-25 11:30:37 Re: RFC: Logging plan of the running query