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
bf7b7210
Commit
bf7b7210
authored
Apr 07, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-add pg_dump fix.
parent
e83621aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
40 deletions
+53
-40
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+53
-40
No files found.
src/bin/pg_dump/pg_dump.c
View file @
bf7b7210
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.
69 1998/04/07 22:00:37
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.
70 1998/04/07 22:36:38
momjian Exp $
*
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
*
...
@@ -79,6 +79,7 @@
...
@@ -79,6 +79,7 @@
#include "pg_dump.h"
#include "pg_dump.h"
static
void
dumpSequence
(
FILE
*
fout
,
TableInfo
tbinfo
);
static
void
dumpSequence
(
FILE
*
fout
,
TableInfo
tbinfo
);
static
void
dumpACL
(
FILE
*
fout
,
TableInfo
tbinfo
);
static
void
static
void
dumpTriggers
(
FILE
*
fout
,
const
char
*
tablename
,
dumpTriggers
(
FILE
*
fout
,
const
char
*
tablename
,
TableInfo
*
tblinfo
,
int
numTables
);
TableInfo
*
tblinfo
,
int
numTables
);
...
@@ -2292,20 +2293,21 @@ GetPrivledges(char *s)
...
@@ -2292,20 +2293,21 @@ GetPrivledges(char *s)
char
*
acls
=
NULL
;
char
*
acls
=
NULL
;
/* Grant All == arwR */
/* Grant All == arwR */
/* INSERT
== ar
*/
/* INSERT
== a
*/
/* UPDATE/DELETE ==
rw
*/
/* UPDATE/DELETE ==
w
*/
/* SELECT == r */
/* SELECT == r */
/* RULE == R */
/* RULE == R */
if
(
strstr
(
s
,
"arwR"
))
if
(
strstr
(
s
,
"arwR"
))
return
(
strdup
(
"ALL"
));
return
(
strdup
(
"ALL"
));
if
(
str
str
(
s
,
"ar"
))
if
(
str
chr
(
s
,
'a'
))
acls
=
AddAcl
(
acls
,
"INSERT"
);
acls
=
AddAcl
(
acls
,
"INSERT"
);
if
(
str
str
(
s
,
"rw"
))
if
(
str
chr
(
s
,
'w'
))
acls
=
AddAcl
(
acls
,
"UPDATE,DELETE"
);
acls
=
AddAcl
(
acls
,
"UPDATE,DELETE"
);
else
if
(
strchr
(
s
,
'r'
))
if
(
strchr
(
s
,
'r'
))
acls
=
AddAcl
(
acls
,
"SELECT"
);
acls
=
AddAcl
(
acls
,
"SELECT"
);
if
(
strchr
(
s
,
'R'
))
if
(
strchr
(
s
,
'R'
))
...
@@ -2378,6 +2380,44 @@ ParseACL(const char *acls, int *count)
...
@@ -2378,6 +2380,44 @@ ParseACL(const char *acls, int *count)
*
count
=
NumAcls
;
*
count
=
NumAcls
;
return
(
ParsedAcl
);
return
(
ParsedAcl
);
}
}
/*
* dumpACL:
* Write out grant/revoke information
* Called for sequences and tables
*/
void
dumpACL
(
FILE
*
fout
,
TableInfo
tbinfo
)
{
int
k
,
l
;
ACL
*
ACLlist
;
ACLlist
=
ParseACL
(
tbinfo
.
relacl
,
&
l
);
if
(
ACLlist
==
(
ACL
*
)
NULL
)
if
(
l
==
0
)
return
;
else
{
fprintf
(
stderr
,
"Could not parse ACL list for %s...Exiting!
\n
"
,
tbinfo
.
relname
);
exit_nicely
(
g_conn
);
}
/* Revoke Default permissions for PUBLIC */
fprintf
(
fout
,
"REVOKE ALL on %s from PUBLIC;
\n
"
,
tbinfo
.
relname
);
for
(
k
=
0
;
k
<
l
;
k
++
)
{
if
(
ACLlist
[
k
].
privledges
!=
(
char
*
)
NULL
)
fprintf
(
fout
,
"GRANT %s on %s to %s;
\n
"
,
ACLlist
[
k
].
privledges
,
tbinfo
.
relname
,
ACLlist
[
k
].
user
);
}
}
/*
/*
* dumpTables:
* dumpTables:
...
@@ -2392,13 +2432,11 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
...
@@ -2392,13 +2432,11 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
{
{
int
i
,
int
i
,
j
,
j
,
k
,
k
;
l
;
char
q
[
MAXQUERYLEN
];
char
q
[
MAXQUERYLEN
];
char
**
parentRels
;
/* list of names of parent relations */
char
**
parentRels
;
/* list of names of parent relations */
int
numParents
;
int
numParents
;
int
actual_atts
;
/* number of attrs in this CREATE statment */
int
actual_atts
;
/* number of attrs in this CREATE statment */
ACL
*
ACLlist
;
/* First - dump SEQUENCEs */
/* First - dump SEQUENCEs */
for
(
i
=
0
;
i
<
numTables
;
i
++
)
for
(
i
=
0
;
i
<
numTables
;
i
++
)
...
@@ -2409,6 +2447,8 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
...
@@ -2409,6 +2447,8 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
{
{
fprintf
(
fout
,
"
\\
connect - %s
\n
"
,
tblinfo
[
i
].
usename
);
fprintf
(
fout
,
"
\\
connect - %s
\n
"
,
tblinfo
[
i
].
usename
);
dumpSequence
(
fout
,
tblinfo
[
i
]);
dumpSequence
(
fout
,
tblinfo
[
i
]);
if
(
acls
)
dumpACL
(
fout
,
tblinfo
[
i
]);
}
}
}
}
...
@@ -2505,36 +2545,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
...
@@ -2505,36 +2545,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
}
}
strcat
(
q
,
";
\n
"
);
strcat
(
q
,
";
\n
"
);
fputs
(
q
,
fout
);
fputs
(
q
,
fout
);
if
(
acls
)
if
(
acls
)
{
dumpACL
(
fout
,
tblinfo
[
i
]);
ACLlist
=
ParseACL
(
tblinfo
[
i
].
relacl
,
&
l
);
if
(
ACLlist
==
(
ACL
*
)
NULL
)
{
if
(
l
==
0
)
continue
;
else
{
fprintf
(
stderr
,
"Could not parse ACL list for %s...Exiting!
\n
"
,
tblinfo
[
i
].
relname
);
exit_nicely
(
g_conn
);
}
}
/* Revoke Default permissions for PUBLIC */
fprintf
(
fout
,
"REVOKE ALL on %s from PUBLIC;
\n
"
,
tblinfo
[
i
].
relname
);
for
(
k
=
0
;
k
<
l
;
k
++
)
{
if
(
ACLlist
[
k
].
privledges
!=
(
char
*
)
NULL
)
fprintf
(
fout
,
"GRANT %s on %s to %s;
\n
"
,
ACLlist
[
k
].
privledges
,
tblinfo
[
i
].
relname
,
ACLlist
[
k
].
user
);
}
}
}
}
}
}
}
}
...
...
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