Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
580cae75
Commit
580cae75
authored
Dec 19, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent service dbname from defaulting to service name, per bug report
from Michael Fuhr
parent
cb95ec2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
23 deletions
+9
-23
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+7
-21
src/interfaces/libpq/pg_service.conf.sample
src/interfaces/libpq/pg_service.conf.sample
+2
-2
No files found.
src/interfaces/libpq/fe-connect.c
View file @
580cae75
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.26
4 2003/11/29 19:52:11 pgsql
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.26
5 2003/12/19 21:50:54 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2367,7 +2367,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
{
char
*
service
=
conninfo_getval
(
options
,
"service"
);
char
*
serviceFile
=
SYSCONFDIR
"/pg_service.conf"
;
int
group_found
=
0
;
bool
group_found
=
false
;
int
linenr
=
0
,
i
;
...
...
@@ -2431,9 +2431,9 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
if
(
strncmp
(
line
+
1
,
service
,
strlen
(
service
))
==
0
&&
line
[
strlen
(
service
)
+
1
]
==
']'
)
group_found
=
1
;
group_found
=
true
;
else
group_found
=
0
;
group_found
=
false
;
}
else
{
...
...
@@ -2445,7 +2445,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
*/
char
*
key
,
*
val
;
int
found_keyword
;
bool
found_keyword
;
key
=
line
;
val
=
strchr
(
line
,
'='
);
...
...
@@ -2460,32 +2460,18 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
}
*
val
++
=
'\0'
;
/*
* If not already set, set the database name to the
* name of the service
*/
for
(
i
=
0
;
options
[
i
].
keyword
;
i
++
)
{
if
(
strcmp
(
options
[
i
].
keyword
,
"dbname"
)
==
0
)
{
if
(
options
[
i
].
val
==
NULL
)
options
[
i
].
val
=
strdup
(
service
);
break
;
}
}
/*
* Set the parameter --- but don't override any
* previous explicit setting.
*/
found_keyword
=
0
;
found_keyword
=
false
;
for
(
i
=
0
;
options
[
i
].
keyword
;
i
++
)
{
if
(
strcmp
(
options
[
i
].
keyword
,
key
)
==
0
)
{
if
(
options
[
i
].
val
==
NULL
)
options
[
i
].
val
=
strdup
(
val
);
found_keyword
=
1
;
found_keyword
=
true
;
break
;
}
}
...
...
src/interfaces/libpq/pg_service.conf.sample
View file @
580cae75
...
...
@@ -5,12 +5,12 @@
# multiple services in this file. Each starts with a service name in
# brackets. Subsequent lines have connection configuration parameters of
# the pattern "param=value". A sample configuration for template1 is
# included in this file. If no database name is specified, it is assumed
# to match the service name. Lines beginning with '#' are comments.
# included in this file. Lines beginning with '#' are comments.
#
# Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
# rename it pg_service.conf.
#
#
#[template1]
#dbname=template1
#user=postgres
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment