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
b099d9e7
Commit
b099d9e7
authored
Mar 27, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder language creation to restore constistently.
Laurent FAILLIE
parent
7a3e7b64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
7 deletions
+30
-7
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+30
-7
No files found.
src/bin/pg_dump/pg_dump.c
View file @
b099d9e7
...
...
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.32
2 2003/03/20 07:05:21
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.32
3 2003/03/27 16:39:17
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -605,6 +605,14 @@ main(int argc, char **argv)
/* Now sort the output nicely */
SortTocByOID
(
g_fout
);
/*
* Procedural languages have to be declared just after
* database and schema creation, before they are used.
*/
MoveToStart
(
g_fout
,
"ACL LANGUAGE"
);
MoveToStart
(
g_fout
,
"PROCEDURAL LANGUAGE"
);
MoveToStart
(
g_fout
,
"FUNC PROCEDURAL LANGUAGE"
);
MoveToStart
(
g_fout
,
"SCHEMA"
);
MoveToStart
(
g_fout
,
"DATABASE"
);
MoveToEnd
(
g_fout
,
"TABLE DATA"
);
...
...
@@ -3626,7 +3634,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
{
char
*
tmp
=
strdup
(
fmtId
(
lanname
));
dumpACL
(
fout
,
"LANGUAGE"
,
tmp
,
lanname
,
dumpACL
(
fout
,
"
ACL
LANGUAGE"
,
tmp
,
lanname
,
finfo
[
fidx
].
pronamespace
->
nspname
,
NULL
,
lanacl
,
lanoid
);
free
(
tmp
);
...
...
@@ -3732,6 +3740,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
char
*
prosecdef
;
char
*
lanname
;
char
*
rettypename
;
char
*
funcproclang
;
/* Boolean : is this function a PLang handler ? */
if
(
finfo
->
dumped
)
goto
done
;
...
...
@@ -3747,7 +3756,8 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
appendPQExpBuffer
(
query
,
"SELECT proretset, prosrc, probin, "
"provolatile, proisstrict, prosecdef, "
"(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) as lanname "
"(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) as lanname, "
"exists (SELECT 'x' FROM pg_catalog.pg_language WHERE lanplcallfoid = pg_catalog.pg_proc.oid) as funcproclang "
"FROM pg_catalog.pg_proc "
"WHERE oid = '%s'::pg_catalog.oid"
,
finfo
->
oid
);
...
...
@@ -3759,7 +3769,8 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
"case when proiscachable then 'i' else 'v' end as provolatile, "
"proisstrict, "
"'f'::boolean as prosecdef, "
"(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname "
"(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname, "
"exists (SELECT 'x' FROM pg_language WHERE lanplcallfoid = pg_proc.oid) as funcproclang "
"FROM pg_proc "
"WHERE oid = '%s'::oid"
,
finfo
->
oid
);
...
...
@@ -3771,7 +3782,8 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
"case when proiscachable then 'i' else 'v' end as provolatile, "
"'f'::boolean as proisstrict, "
"'f'::boolean as prosecdef, "
"(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname "
"(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname, "
"exists (SELECT 'x' FROM pg_language WHERE lanplcallfoid = pg_proc.oid) as funcproclang "
"FROM pg_proc "
"WHERE oid = '%s'::oid"
,
finfo
->
oid
);
...
...
@@ -3802,6 +3814,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
proisstrict
=
PQgetvalue
(
res
,
0
,
PQfnumber
(
res
,
"proisstrict"
));
prosecdef
=
PQgetvalue
(
res
,
0
,
PQfnumber
(
res
,
"prosecdef"
));
lanname
=
PQgetvalue
(
res
,
0
,
PQfnumber
(
res
,
"lanname"
));
funcproclang
=
PQgetvalue
(
res
,
0
,
PQfnumber
(
res
,
"funcproclang"
));
/*
* See backend/commands/define.c for details of how the 'AS' clause is
...
...
@@ -3872,7 +3885,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
ArchiveEntry
(
fout
,
finfo
->
oid
,
funcsig_tag
,
finfo
->
pronamespace
->
nspname
,
finfo
->
usename
,
"FUNCTION
"
,
NULL
,
finfo
->
usename
,
strcmp
(
funcproclang
,
"t"
)
?
"FUNCTION"
:
"FUNC PROCEDURAL LANGUAGE
"
,
NULL
,
q
->
data
,
delqry
->
data
,
NULL
,
NULL
,
NULL
);
...
...
@@ -5024,11 +5037,21 @@ dumpACL(Archive *fout, const char *type, const char *name,
PQExpBuffer
sql
,
grantee
,
grantor
,
privs
,
privswgo
;
bool
found_owner_privs
=
false
;
/* acl_lang is a flag only true if we are dumping language's ACL,
* so we can set 'type' to a value that is suitable to build
* SQL requests as for other types.
*/
bool
acl_lang
=
false
;
if
(
!
strcmp
(
type
,
"ACL LANGUAGE"
)){
type
=
"LANGUAGE"
;
acl_lang
=
true
;
}
if
(
strlen
(
acls
)
==
0
)
return
;
/* object has default permissions */
#define MKENTRY(grantor, command) \
ArchiveEntry(fout, objoid, tag, nspname, grantor ? grantor : "",
"ACL"
, NULL, command, "", NULL, NULL, NULL)
ArchiveEntry(fout, objoid, tag, nspname, grantor ? grantor : "",
acl_lang ? "ACL LANGUAGE" : "ACL"
, NULL, command, "", NULL, NULL, NULL)
sql
=
createPQExpBuffer
();
grantee
=
createPQExpBuffer
();
...
...
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