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
26a23e33
Commit
26a23e33
authored
Dec 13, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add enable_plpgsql from Oliver.
parent
2d116769
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
src/pl/plpgsql/enable_plpgsql
src/pl/plpgsql/enable_plpgsql
+68
-0
No files found.
src/pl/plpgsql/enable_plpgsql
0 → 100644
View file @
26a23e33
#!/bin/sh
# Enable the PL procedural language for PostgreSQL in one or more
# existing databases.
#
# This script should be run by the PostgreSQL superuser
enable_database
()
{
if
!
psql
-d
$1
-qtc
"select count(*) from pg_language where lanname='plpgsql'"
>
$TMPFIL2
2>&1
then
echo
"Cannot connect to
$1
"
exit
2
fi
if
[
`
cat
$TMPFIL2
`
-eq
0
]
then
if
!
psql
-d
$1
<
$sqlfile
then
echo
"Failed to add PL to
$1
"
exit
2
fi
echo
"PL added to
$1
"
else
echo
"PL is already enabled in
$1
"
fi
}
# Execution starts here
TMPFILE
=
`
mktemp
/tmp/enable_pgpl.XXXXXX
`
TMPFIL2
=
`
mktemp
/tmp/enable_pgpl.XXXXXX
`
trap
"rm
$TMPFILE
$TMPFIL2
"
EXIT
sqlfile
=
${
PGLIB
:
=/usr/local/pgsql/lib
}
/mklang_pl.sql
if
[
!
-f
$sqlfile
]
then
echo
"Cannot find mklang_pl.sql"
exit
2
fi
if
[
-z
"
$1
"
]
then
echo
"Syntax:
$0
--all | database ..."
exit
1
fi
if
[
$1
=
"--all"
]
then
if
!
psql
-t
-c
"select datname from pg_database order by datname"
>
$TMPFILE
then
echo
Cannot
select
databases
exit
2
fi
for
db
in
`
cat
$TMPFILE
`
do
enable_database
$db
done
else
while
[
-n
"
$1
"
]
do
db
=
$1
enable_database
$db
shift
done
fi
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