Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
postgresql-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PostgreSQL
postgresql-common
Commits
fecbaad0
Commit
fecbaad0
authored
20 years ago
by
Martin Pitt
Browse files
Options
Downloads
Patches
Plain Diff
merge changes from at-work branch
parent
34faa042
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
postgresql-common-1/pg_createcluster
+15
-1
15 additions, 1 deletion
postgresql-common-1/pg_createcluster
postgresql-common-1/pg_ctlcluster
+10
-4
10 additions, 4 deletions
postgresql-common-1/pg_ctlcluster
postgresql-common-1/pg_wrapper
+33
-6
33 additions, 6 deletions
postgresql-common-1/pg_wrapper
with
58 additions
and
11 deletions
postgresql-common-1/pg_createcluster
+
15
−
1
View file @
fecbaad0
...
...
@@ -32,7 +32,9 @@ sub init_db {
}
}
# move a file to a directory with defined permissions
# move a file to a directory with defined permissions; if $version is smaller
# than 8.0, put a symlink at the old location (PostgreSQL prior to 8.0 does not
# support configurable conffiles).
# Arguments: <source file> <target dir> <uid> <gid> <perms>
sub
move_conffile
{
(
$file
,
$target
,
$uid
,
$gid
,
$perms
)
=
@_
;
...
...
@@ -42,6 +44,18 @@ sub move_conffile {
error
"
move_conffile: could not install
$file
";
}
unlink
$file
;
if
(
$version
<
8
)
{
@pathcomps
=
split
('
/
',
$file
);
$target
.=
'
/
'
.
$pathcomps
[
-
1
];
$oldgid
=
$
);
$olduid
=
$>
;
$
)
=
$gid
;
$>
=
$uid
;
symlink
$target
,
$file
;
$>
=
$olduid
;
$
)
=
$oldgid
;
}
}
else
{
error
"
move_conffile: required configuration file
$file
does not exist
";
}
...
...
This diff is collapsed.
Click to expand it.
postgresql-common-1/pg_ctlcluster
+
10
−
4
View file @
fecbaad0
...
...
@@ -21,9 +21,14 @@ if ($#ARGV != 2) {
sub
start
{
my
$cdir
=
$info
{'
configdir
'};
exec
$pg_ctl
,
'
-D
',
$info
{'
pgdata
'},'
-l
',
$info
{'
logfile
'},
'
-s
',
'
-o
',
"
-c config_file=
\"
$cdir
/postgresql.conf
\"
-c hba_file=
\"
$cdir
/pg_hba.conf
\"
-c ident_file=
\"
$cdir
/pg_ident.conf
\"
",
'
start
';
@options
=
('
start
',
'
-D
',
$info
{'
pgdata
'},'
-l
',
$info
{'
logfile
'},
'
-s
',
'
-o
');
# versions 8.0+ support configurable conffile locations
if
(
$version
>=
8
)
{
push
@options
,
"
-c config_file=
\"
$cdir
/postgresql.conf
\"
-c hba_file=
\"
$cdir
/pg_hba.conf
\"
-c ident_file=
\"
$cdir
/pg_ident.conf
\"
";
}
exec
$pg_ctl
,
@options
;
}
sub
stop
{
...
...
@@ -65,7 +70,8 @@ sub reload {
# main
#
%info
=
cluster_info
(
$ARGV
[
0
],
$ARGV
[
1
]);
$version
=
$ARGV
[
0
];
%info
=
cluster_info
(
$version
,
$ARGV
[
1
]);
error
"
specified cluster does not exist
"
unless
$info
{'
pgdata
'};
...
...
This diff is collapsed.
Click to expand it.
postgresql-common-1/pg_wrapper
+
33
−
6
View file @
fecbaad0
...
...
@@ -14,8 +14,22 @@ use PgCommon;
$cmd
=
(
split
'
/
',
$
0
)[
-
1
];
grep
{
$cmd
eq
$_
}
@commands
or
die
"
pg_wrapper: invalid command name
$cmd
";
# Determine $version, $cluster, $db, $port
(
$version
,
$cluster
,
$db
)
=
user_cluster_map
();
# Check for --cluster argument and filter it out
for
(
$i
=
0
;
$i
<=
$#ARGV
;
++
$i
)
{
if
(
$ARGV
[
$i
]
eq
'
--cluster
')
{
error
'
--cluster option needs an argument (<version>/<cluster>)
'
if
(
$i
>=
$#ARGV
);
(
$version
,
$cluster
)
=
split
('
/
',
$ARGV
[
$i
+
1
],
2
);
error
'
No version specified with --cluster
'
unless
$version
;
error
'
No cluster specified with --cluster
'
unless
$cluster
;
splice
@ARGV
,
$i
,
2
;
last
;
}
}
# Determine $version, $cluster, $db, $port from map files
(
$version
,
$cluster
,
$db
)
=
user_cluster_map
()
unless
$cluster
;
if
(
$cluster
)
{
$port
=
(
get_conf_value
$version
,
$cluster
,
'
port
');
}
...
...
@@ -24,6 +38,7 @@ $ENV{'PGPORT'} = "$port" if $port;
$ENV
{'
PGDATABASE
'}
=
$db
if
$db
;
@args
=
(
get_program_path
(
$cmd
,
$version
));
error
'
Invalid PostgreSQL cluster version
'
unless
$args
[
0
];
push
@args
,
@ARGV
;
exec
@args
;
...
...
@@ -33,13 +48,25 @@ __END__
pg_wrapper - wrapper for PostgreSQL client commands
=head1 SYNOPSIS
B<psql> [B<--cluster> I<version>/I<cluster>] [...]
B<createdb> [B<--cluster> I<version>/I<cluster>] [...]
B<dropdb> [B<--cluster> I<version>/I<cluster>] [...]
=head1 DESCRIPTION
This program is run only as a link to names which correspond to PostgreSQL
programs in B</usr/lib/postgresql/>I<version>B</bin>. It finds the correct
cluster and database for the user and calls the correct version of the desired
program to connect to that cluster and database, supplying any specifed options
to that command.
programs in B</usr/lib/postgresql/>I<version>B</bin>. It determines the
configured cluster and database for the user and calls the appropriate version
of the desired program to connect to that cluster and database, supplying any
specifed options to that command.
By default, the cluster is determined from the configuration files
L<user_clusters(5)> and L<postgresqlrc(5)>. However, this can be overriden by
specifying the B<--cluster> I<version>/I<cluster> option.
=head1 FILES
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment