Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit14d9b37

Browse files
committed
libpq: Remove deprecated connection parameters authtype and tty
The authtype parameter was deprecated and made inactive in commitd5bbe2a, but the environment variable was left defined and thustested with a getenv call even though the value is of no use. Also,if it would exist it would be copied but never freed as the cleanupcode had been removed.tty was deprecated in commitcb7fb3c but most of theinfrastructure around it remained in place.Author: Daniel Gustafsson <daniel@yesql.se>Discussion:https://postgr.es/m/DDDF36F3-582A-4C02-8598-9B464CC42B34@yesql.se
1 parent096bbf7 commit14d9b37

File tree

4 files changed

+17
-41
lines changed

4 files changed

+17
-41
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ PGconn *PQsetdbLogin(const char *pghost,
232232
if it had been passed to <xref linkend="libpq-PQconnectdb"/>, and the remaining
233233
parameters are then applied as specified for <xref linkend="libpq-PQconnectdbParams"/>.
234234
</para>
235+
236+
<para>
237+
<literal>pgtty</literal> is no longer used and any value passed will
238+
be ignored.
239+
</para>
235240
</listitem>
236241
</varlistentry>
237242

@@ -2119,10 +2124,10 @@ char *PQport(const PGconn *conn);
21192124

21202125
<listitem>
21212126
<para>
2122-
Returns the debug <acronym>TTY</acronym> of the connection.
2123-
(This is obsolete, since the server no longer pays attention
2124-
to the <acronym>TTY</acronym> setting, butthefunction remains
2125-
for backward compatibility.)
2127+
This function no longer does anything, but it remains for backwards
2128+
compatibility. The function always return an empty string, or
2129+
<symbol>NULL</symbol> ifthe<parameter>conn</parameter> argument is
2130+
<symbol>NULL</symbol>.
21262131

21272132
<synopsis>
21282133
char *PQtty(const PGconn *conn);

‎src/interfaces/libpq/fe-connect.c

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ static intldapServiceLookup(const char *purl, PQconninfoOption *options,
120120
* by environment variables
121121
*/
122122
#defineDefaultHost"localhost"
123-
#defineDefaultTty""
124123
#defineDefaultOption""
125-
#defineDefaultAuthtype ""
126124
#ifdefUSE_SSL
127125
#defineDefaultChannelBinding"prefer"
128126
#else
@@ -192,14 +190,6 @@ typedef struct _internalPQconninfoOption
192190
}internalPQconninfoOption;
193191

194192
staticconstinternalPQconninfoOptionPQconninfoOptions[]= {
195-
/*
196-
* "authtype" is no longer used, so mark it "don't show". We keep it in
197-
* the array so as not to reject conninfo strings from old apps that might
198-
* still try to set it.
199-
*/
200-
{"authtype","PGAUTHTYPE",DefaultAuthtype,NULL,
201-
"Database-Authtype","D",20,-1},
202-
203193
{"service","PGSERVICE",NULL,NULL,
204194
"Database-Service","",20,-1},
205195

@@ -243,14 +233,6 @@ static const internalPQconninfoOption PQconninfoOptions[] = {
243233
"Client-Encoding","",10,
244234
offsetof(structpg_conn,client_encoding_initial)},
245235

246-
/*
247-
* "tty" is no longer used either, but keep it present for backwards
248-
* compatibility.
249-
*/
250-
{"tty","PGTTY",DefaultTty,NULL,
251-
"Backend-Debug-TTY","D",40,
252-
offsetof(structpg_conn,pgtty)},
253-
254236
{"options","PGOPTIONS",DefaultOption,NULL,
255237
"Backend-Options","",40,
256238
offsetof(structpg_conn,pgoptions)},
@@ -1581,15 +1563,6 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
15811563
gotooom_error;
15821564
}
15831565

1584-
if (pgtty&&pgtty[0]!='\0')
1585-
{
1586-
if (conn->pgtty)
1587-
free(conn->pgtty);
1588-
conn->pgtty=strdup(pgtty);
1589-
if (!conn->pgtty)
1590-
gotooom_error;
1591-
}
1592-
15931566
if (login&&login[0]!='\0')
15941567
{
15951568
if (conn->pguser)
@@ -4031,8 +4004,6 @@ freePGconn(PGconn *conn)
40314004
free(conn->pghostaddr);
40324005
if (conn->pgport)
40334006
free(conn->pgport);
4034-
if (conn->pgtty)
4035-
free(conn->pgtty);
40364007
if (conn->connect_timeout)
40374008
free(conn->connect_timeout);
40384009
if (conn->pgtcp_user_timeout)
@@ -6633,12 +6604,16 @@ PQport(const PGconn *conn)
66336604
return"";
66346605
}
66356606

6607+
/*
6608+
* No longer does anything, but the function remains for API backwards
6609+
* compatibility.
6610+
*/
66366611
char*
66376612
PQtty(constPGconn*conn)
66386613
{
66396614
if (!conn)
66406615
returnNULL;
6641-
returnconn->pgtty;
6616+
return"";
66426617
}
66436618

66446619
char*

‎src/interfaces/libpq/libpq-int.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,6 @@ struct pg_conn
338338
* precedence over pghost. */
339339
char*pgport;/* the server's communication port number, or
340340
* a comma-separated list of ports */
341-
char*pgtty;/* tty on which the backend messages is
342-
* displayed (OBSOLETE, NOT USED) */
343341
char*connect_timeout;/* connection timeout (numeric string) */
344342
char*pgtcp_user_timeout;/* tcp user timeout (numeric string) */
345343
char*client_encoding_initial;/* encoding to use */

‎src/test/examples/testlibpq4.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ main(int argc, char **argv)
5050
{
5151
char*pghost,
5252
*pgport,
53-
*pgoptions,
54-
*pgtty;
53+
*pgoptions;
5554
char*dbName1,
5655
*dbName2;
5756
char*tblName;
@@ -88,13 +87,12 @@ main(int argc, char **argv)
8887
pgport=NULL;/* port of the backend */
8988
pgoptions=NULL;/* special options to start up the backend
9089
* server */
91-
pgtty=NULL;/* debugging tty for the backend */
9290

9391
/* make a connection to the database */
94-
conn1=PQsetdb(pghost,pgport,pgoptions,pgtty,dbName1);
92+
conn1=PQsetdb(pghost,pgport,pgoptions,NULL,dbName1);
9593
check_prepare_conn(conn1,dbName1);
9694

97-
conn2=PQsetdb(pghost,pgport,pgoptions,pgtty,dbName2);
95+
conn2=PQsetdb(pghost,pgport,pgoptions,NULL,dbName2);
9896
check_prepare_conn(conn2,dbName2);
9997

10098
/* start a transaction block */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp