Conversation
7140709 to
7221569
Compare
7221569 to
226fa9f
Compare
|
| on_linux do | ||
| depends_on "gcc" if DevelopmentTools.gcc_version < 13 |
There was a problem hiding this comment.
This conditional should not be used for runtime dependencies as it will result in broken dependency trees. It isn't correct to use a build time compiler constraint to calculate the runtime dependency as a bottle built with GCC 15 is likely broken on GCC < 15.
The GCC usage is also what we do not allow in Homebrew/core. We have an audit specifically to prevent using newer libstdc++ in formulae that have dependents linked to libraries. There are only a few exceptions we allow:
- Executable-only formulae, e.g.
btop, which we don't need to worry about propagating newer libstdc++ - Leaf formulae, e.g.
libunicode. We currently need to manually make sure a formula never uses it as a dependency in Homebrew/core.
Anything else should remain on last compatible version until we handle Ubuntu CI upgrade as want Linux bottles to target a specific ABI - https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
Current time frame for Ubuntu 24.04 is possibly a couple months (brew 5.2.0) since this is a Tier impacting change - https://docs.brew.sh/Support-Tiers#linux (system glibc will be increased to 2.39)
Will link to related work items in
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a |
Created by
brew bumpCreated with
brew bump-formula-pr.Details
release notes
questions, often before I even see them.
first donor-level sponsor.
ComPosiX, and the whole Eonics Mastermind team.
C++ language changes.
ground, all the way back.
improvements.
What's changed?
Just about everything has changed at least a little bit.
Most "standard" code using libpqxx will still work without changes, but often
you'll find that there are now better ways to do things. Functions and classes
that were deprecated three years ago are now gone. Some other ones are now
deprecated, and will be gone a few years from now.
The API has become better at helping you keep your code memory-safe and
verifiable by static code analysis. There are fewer raw, C-style pointers.
At the same time some things have become more efficient through the use of
views, especially
string_view, and internal simplifications. Ranges andspans have made things clearer and simpler. Concepts have made some things
more flexible.
More details follow. See the
NEWSfile for a more complete list with lessdetail, or
UPGRADING.mdfor advice on how to deal with breaking changes.Things that can break with old code
If you're just using 8.0 as a drop-in replacement for an older version in an
existing application, this may be the only useful section for you.
C++20 is now the minimum. As per the above it's fine if some C++20
features don't work for you yet, but concepts definitely need to work, and
you'll need a bunch of the new C++20 standard library features.
PostgreSQL 11 is now the absolute minimum. You won't be able to connect to
older servers. The exact version is a fairly arbitrary choice. The oldest
version supported upstream is 14, so hopefully 11 is liberal enough.
Exceptions have changed. The whole class hierarchy is different, so if
you do any detailed catching you'll have to review that. On the bright side,
libpqxx exceptions are now all derived from
pqxx::failureso you may not needas many
catchblocks as before. Your handler can figure out much of what itneeds by calling the exception's member functions, rather than by knowing its
type.
Rows and fields have changed. The old
rowandfieldclasses used tokeep a result object alive in memory, even if you destroyed the
resultobject. Now, most of the time you'll get a
row_reforfield_refwhich doesnot do that. Be careful with lifetimes, but it rarely becomes an issue, and
the new classes are simpler and more efficient.
Result & row iterators have changed. Indexing an iterator now finally does
what the C++ standard says, even though it's probably less intuitive or useful.
If you previously did
i[n], you'd now do(*i)[n].Comparing results, rows, or fields now compares identity, not contents. I
doubt anyone ever used what these
==operators did.pqxx::bytesis now an alias forstd::vector<std::byte>, not astd::basic_string<std::byte>. It's not clear that the fine print in thestandard ever quite allowed the string definition. Some code will require
small changes at compile time. If you ever used the
c_str()member function,now you'll use
data(). More appropriate for binary data.The string conversion API has changed. This is the extensible API that
converts between C++-side objects and their SQL text formats. If you wrote
your own to support additional types, those should still work; but the newer
API is generally easier, safer, and more efficient if you want to optimise.
A lot of strings no longer have or need a terminating zero. This includes
the string conversion API.
In some situations, a
paramswill require text encoding information. Inthose situations, pass your connection, transaction, or encoding group as the
first argument to the
paramsconstructor.No longer supports
std::filesystem. Nor does the build try to figure outwhether it needs to link any additional libraries to make it work.
A
zviewcan no longer contain a null pointer. This used to be valid forempty strings, but it no longer is.
More classes are now
final.The scripts in
tools/have been revised. Shell scripts now have a ".sh"suffix to their name. Some old tools are gone:
rmlo,pqxxthreadsafety,test_all.py.The JOHAB encoding is not supported. As far as we can tell, there is no
single standard for how this encoding was supposed to work, and support on the
server side never fully worked anyway. It will be removed from PostgreSQL.
Some deprecated items are now gone:
binarystring(useblobinstead).connection_base(use justconnection, it's the same thing).encrypt_password()(use the equivalents inconnection).dynamic_params(useparamsinstead).transaction_base::unesc_raw()(useunesc_bin()instead).transaction_base::quote_raw()(usequote(bytes_view)instead).fieldconstructors.Querying continues to evolve
Querying data has been growing simpler and more regular for a while now. But
I'll summarise how the 8.0 way of querying differs from the old ways.
Passing statement parameters: You no longer call separate
exec(),exec_params(), orexec_prepared(). Instead, you just callexec(), andin addition to the query, pass a
paramsobject if the statement needsparameters. If the query is a prepared statement rather than SQL text, you
use its name, wrapped in a
pqxx::preppedobject:tx.exec( pqxx::prepped{"my_query"}, pqxx::params{1, 23, "param");Executing, querying, streaming: These are the three models for executing a
query, and where possible they look similar. "Executing" a query is the
classic
exec()function, and it returns apqxx::result. "Querying" worksvery similar, but you pass template arguments to state which types of result
columns you expect, and then you iterate over the return value. "Streaming"
looks a lot like querying but is optimised for large data sets: it's slower for
small numbers of rows but faster for large numbers. (Sadly a streaming query
can not take parameters.)
Expected result sizes: If you want to make sure that a query returns a
specific number of rows, you no longer use
exec0(),exec1(), orexec_n();you just use
exec()and then call a member function on the result such asno_rows(),one_row(), orexpected_rows(). There are similar functionsfor the number of columns.
Various new features
This is not a complete list! There's more than I can fit in here. You'll
have to explore the documentation or the code to find them all.
Here are some major ones:
Example code. There is now an
examples/directory containing source forvarious toy applications. There will be more in the future. Unlike the tests,
these examples are entirely meant for you, to illustrate what you can do with
libpqxx. But unlike the documentation, they get compiled and run along with
the test, so they won't fall out of date.
Source locations & stack traces: A libpqxx exception can now tell you the
associated
std::source_locationand, if your compiler supports it, a fullstd::stacktrace.Easier SQL arrays: Single-dimensional SQL arrays are now super easy, barely
an inconvenience. You can now pass a
std::vector<double>as a statementparameter and libpqxx will convert it to an SQL array. You can stream a
std::array<std::string>directly out of an SQL array in a query, read aresult field of SQL array type as a
std::inplace_vector<int>, and so on.Multi-dimensional arrays are a bit harder, but not much: the
pqxx::arrayclass does all the parsing for you.
Generic binary data: Where you need to pass binary data to a libpqxx
function, you can now generally pass any contiguous block of
std::byte.Result & row iterators are now proper random access iterators. This may
allow some algorithms to work more efficiently.
Encoding groups. Sometimes when dealing with text, libpqxx needs to know
its encoding. It doesn't need to know the exact encoding, but it does need
enough information to be able to tell, for example, a closing quote in an SQL
string from a byte in a multibyte character that happens to have the exact same
value. There is an enum to describe the different basic encoding schemes, and
it is now part of the public API.
Combine connection strings and connection parameters. You could already
create a connection based on a connection string, or on key/value parameters.
Now you can pass both.
Nicer
connection::port_number()to replaceconnection::port(). The oldfunction returned a C string, thanks to the underlying C API. The useful
information is "either a number, or nothing." The new function returns
std::optional<int>as you'd expect.If available, uses C++ Reflection to obtain type names. This replaces a
bunch of string constants that triggered false-positive alerts in some
verification tools such as Valgrind.
Build improvements
The build has also seen some improvement:
Minimum C++ version. If you're building as C++20, you no longer need to
pass an explicit option like
-std=c++20on the compiler command line. Boththe CMake build and the
configurebuild now default to C++20 if nothing isspecified.
Unity builds. This style of build combines multiple C++ translation units
into a single huge C++ file. This enables some cross-module optimisation, but
(under the right circumstances) can also speed up the build. This is now
supported in the CMake build.
More parallelism in
configurebuild. A new, "flattened" hierarchy of"make" targets reduces unused CPU time while compiling. The tests are now in a
single directory.
Various MSVC fixes. There were some compilation problems, and lots of
warnings, with Microsoft Visual Studio in particular. There was even an error
(apparently due to a compiler bug) in the 2026 edition. Fixed.
Test against ASCII-only databases. The regular libpqxx CI tests run
against databases that support full Unicode. But some users test against
ASCII-only databases, which broke the more advanced tests. The tests will now
skip those checks if the database does not support Unicode.
Handy function to render a
std::source_locationas text. Calledsource_loc(), this produces a more or less standard format that IDEs seem toparse well, but which humans can also read.
Only one generated config header. When you configured a build, it used to
generate several
config-*.hheaders in your build tree'sinclude/pqxx/directory. Now it's only
config-compiler.h. And it contains only relevantmacros, prefixed with "PQXX", even in the CMake build.
If you like it
Libpqxx represents decades of FTE work, mostly done in my spare time. If
you would like to support this, please consider sponsoring by a small amount
that you can spare:
This helps me pay for the costs of maintaining and publishing the library, and
if enough people contribute, I'd like to do something nice for those who
contribute their time, insights, and effort by supporting fellow users or
submitting patches.
View the full release notes at https://github.com/jtv/libpqxx/releases/tag/8.0.0.