Instead of sending application_name as a SET command after the connection

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 3dfcf8cc15aeae3d30a0470b7d6bd5d4d462805d
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2009-12-02T04:38:35Z
Releases: 9.0.0
Instead of sending application_name as a SET command after the connection
is made, include it in the startup-packet options.  This makes it work more
like every other libpq connection option, in particular it now has the same
response to RESET ALL as the rest.  This also saves one network round trip
for new applications using application_name.  The cost is that if the server
is pre-8.5, it'll reject the startup packet altogether, forcing us to retry
the entire connection cycle.  But on balance we shouldn't be optimizing that
case in preference to the behavior with a new server, especially when doing
so creates visible behavioral oddities.  Per discussion.

Files

PathChange+/−
src/interfaces/libpq/fe-connect.c modified +67 −174
src/interfaces/libpq/fe-protocol3.c modified +22 −33
src/interfaces/libpq/libpq-int.h modified +2 −10