Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc74257e

Browse files
committed
- Support for relkind = RELKIND_VIEW.
- Use symbols for tests on relkind (ie. use RELKIND_VIEW, not 'v')- Fix bug in support for -b option (== --blobs).- Dump views as views (using 'create view').- Remove 'isViewRule' since we check the relkind when getting tables.- Now uses temp table 'pgdump_oid' rather than 'pg_dump_oid' (errors otherwise).- Added extra param for specifying handling of OID=0 and which typename to output.- Fixed bug in SQL scanner when SQL contained braces. (in rules)- Use format_type function wherever possible
1 parent6d9299e commitc74257e

File tree

5 files changed

+217
-200
lines changed

5 files changed

+217
-200
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.45 2000/08/06 17:50:48 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.46 2000/09/15 04:35:16 pjw Exp $
1212
*
1313
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1414
*
1515
* - Fixed dumpTable output to output lengths for char and varchar types!
1616
* - Added single. quote to twin single quote expansion for 'insert' string
1717
* mode.
1818
*
19+
* Modifications 14-Sep-2000 - pjw@rhyme.com.au
20+
*-Added enum for findTypeByOid to specify how to handle OID and which
21+
*string to return - formatted type, or base type. If the base type
22+
*is returned then fmtId is called on the string.
23+
*
24+
*BEWARE: Since fmtId uses a static buffer, using 'useBaseTypeName' on more
25+
*than one call in a line will cause problems.
26+
*
1927
*-------------------------------------------------------------------------
2028
*/
2129

@@ -50,17 +58,32 @@ static intstrInArray(const char *pattern, char **arr, int arr_size);
5058
*/
5159

5260
char*
53-
findTypeByOid(TypeInfo*tinfo,intnumTypes,constchar*oid)
61+
findTypeByOid(TypeInfo*tinfo,intnumTypes,constchar*oid,OidOptionsopts)
5462
{
5563
inti;
5664

57-
if (strcmp(oid,"0")==0)
58-
returng_opaque_type;
65+
if (strcmp(oid,"0")==0) {
66+
67+
if ( (opts&zeroAsOpaque)!=0 ) {
68+
69+
returng_opaque_type;
70+
71+
}elseif ( (opts&zeroAsAny)!=0 ) {
72+
73+
return"'any'";
74+
75+
}
76+
}
5977

6078
for (i=0;i<numTypes;i++)
6179
{
62-
if (strcmp(tinfo[i].oid,oid)==0)
63-
returntinfo[i].typname;
80+
if (strcmp(tinfo[i].oid,oid)==0) {
81+
if ( (opts&useBaseTypeName)!=0 ) {
82+
returnfmtId(tinfo[i].typname, false);
83+
}else {
84+
returntinfo[i].typedefn;
85+
}
86+
}
6487
}
6588

6689
/* should never get here */

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
*
2121
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2222
*
23-
*Initial version.
23+
*Initial version.
24+
*
25+
* Modifications - 15-Sep-2000 - pjw@rhyme.com.au
26+
*-Added braceDepth to sqlparseInfo to handle braces in rule definitions.
2427
*
2528
*-------------------------------------------------------------------------
2629
*/
@@ -59,7 +62,7 @@ typedef z_stream *z_streamp;
5962

6063
#defineK_VERS_MAJOR 1
6164
#defineK_VERS_MINOR 4
62-
#defineK_VERS_REV11
65+
#defineK_VERS_REV14
6366

6467
/* Data block types */
6568
#defineBLK_DATA 1
@@ -124,6 +127,7 @@ typedef struct {
124127
sqlparseStatestate;
125128
charlastChar;
126129
charquoteChar;
130+
intbraceDepth;
127131
}sqlparseInfo;
128132

129133
typedefstruct_archiveHandle {

‎src/bin/pg_dump/pg_backup_db.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
483483

484484
caseSQL_SCAN:/* Default state == 0, set in _allocAH */
485485

486-
if (qry[pos]==';')
486+
if (qry[pos]==';'&&AH->sqlparse.braceDepth==0)
487487
{
488488
/* Send It & reset the buffer */
489489
/* fprintf(stderr, " sending: '%s'\n\n", AH->sqlBuf->data); */
@@ -507,7 +507,16 @@ int ExecuteSqlCommandBuf(ArchiveHandle* AH, void *qryv, int bufLen)
507507
elseif (qry[pos]=='*'&&AH->sqlparse.lastChar=='/')
508508
{
509509
AH->sqlparse.state=SQL_IN_EXT_COMMENT;
510+
}
511+
elseif (qry[pos]=='(' )
512+
{
513+
AH->sqlparse.braceDepth++;
510514
}
515+
elseif (qry[pos]==')')
516+
{
517+
AH->sqlparse.braceDepth--;
518+
}
519+
511520
AH->sqlparse.lastChar=qry[pos];
512521
}
513522

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp