@ -1205,7 +1205,7 @@ setup_connection(Archive *AH, const char *dumpencoding,
{
PQExpBuffer query = createPQExpBuffer ( ) ;
appendPQExpBuffer ( query , " SET TRANSACTION SNAPSHOT " ) ;
appendPQExpBufferStr ( query , " SET TRANSACTION SNAPSHOT " ) ;
appendStringLiteralConn ( query , AH - > sync_snapshot_id , conn ) ;
ExecuteSqlStatement ( AH , query - > data ) ;
destroyPQExpBuffer ( query ) ;
@ -1315,7 +1315,7 @@ expand_schema_name_patterns(Archive *fout,
for ( cell = patterns - > head ; cell ; cell = cell - > next )
{
appendPQExpBuffer ( query ,
appendPQExpBufferStr ( query ,
" SELECT oid FROM pg_catalog.pg_namespace n \n " ) ;
processSQLNamePattern ( GetConnection ( fout ) , query , cell - > val , false ,
false , NULL , " n.nspname " , NULL , NULL ) ;
@ -3733,7 +3733,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
if ( polinfo - > polwithcheck ! = NULL )
appendPQExpBuffer ( query , " WITH CHECK (%s) " , polinfo - > polwithcheck ) ;
appendPQExpBuffer ( query , " ; \n " ) ;
appendPQExpBufferStr ( query , " ; \n " ) ;
appendPQExpBuffer ( delqry , " DROP POLICY %s " , fmtId ( polinfo - > polname ) ) ;
appendPQExpBuffer ( delqry , " ON %s; \n " , fmtQualifiedDumpable ( tbinfo ) ) ;
@ -4560,7 +4560,7 @@ getNamespaces(Archive *fout, int *numNamespaces)
init_acl_subquery - > data ,
init_racl_subquery - > data ) ;
appendPQExpBuffer ( query , " ) " ) ;
appendPQExpBufferStr ( query , " ) " ) ;
destroyPQExpBuffer ( acl_subquery ) ;
destroyPQExpBuffer ( racl_subquery ) ;
@ -5248,7 +5248,7 @@ getAccessMethods(Archive *fout, int *numAccessMethods)
query = createPQExpBuffer ( ) ;
/* Select all access methods from pg_am table */
appendPQExpBuffer ( query , " SELECT tableoid, oid, amname, amtype, "
appendPQExpBufferStr ( query , " SELECT tableoid, oid, amname, amtype, "
" amhandler::pg_catalog.regproc AS amhandler "
" FROM pg_am " ) ;
@ -8128,7 +8128,7 @@ getTransforms(Archive *fout, int *numTransforms)
query = createPQExpBuffer ( ) ;
appendPQExpBuffer ( query , " SELECT tableoid, oid, "
appendPQExpBufferStr ( query , " SELECT tableoid, oid, "
" trftype, trflang, trffromsql::oid, trftosql::oid "
" FROM pg_transform "
" ORDER BY 3,4 " ) ;
@ -8255,7 +8255,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
resetPQExpBuffer ( q ) ;
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" SELECT \n "
" a.attnum, \n "
" a.attname, \n "
@ -8272,29 +8272,29 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
" pg_catalog.format_type(t.oid, a.atttypmod) AS atttypname, \n " ) ;
if ( fout - > remoteVersion > = 120000 )
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" a.attgenerated, \n " ) ;
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" '' AS attgenerated, \n " ) ;
if ( fout - > remoteVersion > = 110000 )
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" CASE WHEN a.atthasmissing AND NOT a.attisdropped "
" THEN a.attmissingval ELSE null END AS attmissingval, \n " ) ;
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" NULL AS attmissingval, \n " ) ;
if ( fout - > remoteVersion > = 100000 )
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" a.attidentity, \n " ) ;
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" '' AS attidentity, \n " ) ;
if ( fout - > remoteVersion > = 90200 )
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" pg_catalog.array_to_string(ARRAY( "
" SELECT pg_catalog.quote_ident(option_name) || "
" ' ' || pg_catalog.quote_literal(option_value) "
@ -8302,7 +8302,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
" ORDER BY option_name "
" ), E', \n ') AS attfdwoptions, \n " ) ;
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" '' AS attfdwoptions, \n " ) ;
if ( fout - > remoteVersion > = 90100 )
@ -8312,19 +8312,19 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
* collation is different from their type ' s default , we use a CASE
* here to suppress uninteresting attcollations cheaply .
*/
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" CASE WHEN a.attcollation <> t.typcollation "
" THEN a.attcollation ELSE 0 END AS attcollation, \n " ) ;
}
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" 0 AS attcollation, \n " ) ;
if ( fout - > remoteVersion > = 90000 )
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" array_to_string(a.attoptions, ', ') AS attoptions \n " ) ;
else
appendPQExpBuffer ( q ,
appendPQExpBufferStr ( q ,
" '' AS attoptions \n " ) ;
/* need left join here to not fail on dropped columns ... */
@ -12331,7 +12331,7 @@ dumpTransform(Archive *fout, TransformInfo *transform)
if ( transform - > trftosql )
{
if ( transform - > trffromsql )
appendPQExpBuffer ( defqry , " , " ) ;
appendPQExpBufferStr ( defqry , " , " ) ;
if ( tosqlFuncInfo )
{
@ -12349,7 +12349,7 @@ dumpTransform(Archive *fout, TransformInfo *transform)
pg_log_warning ( " bogus value in pg_transform.trftosql field " ) ;
}
appendPQExpBuffer ( defqry , " ); \n " ) ;
appendPQExpBufferStr ( defqry , " ); \n " ) ;
appendPQExpBuffer ( labelq , " TRANSFORM FOR %s LANGUAGE %s " ,
transformType , lanname ) ;
@ -12724,10 +12724,10 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo)
switch ( aminfo - > amtype )
{
case AMTYPE_INDEX :
appendPQExpBuffer ( q , " TYPE INDEX " ) ;
appendPQExpBufferStr ( q , " TYPE INDEX " ) ;
break ;
case AMTYPE_TABLE :
appendPQExpBuffer ( q , " TYPE TABLE " ) ;
appendPQExpBufferStr ( q , " TYPE TABLE " ) ;
break ;
default :
pg_log_warning ( " invalid type \" %c \" of access method \" %s \" " ,
@ -13433,22 +13433,22 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
qcollname = pg_strdup ( fmtId ( collinfo - > dobj . name ) ) ;
/* Get collation-specific details */
appendPQExpBuffer ( query , " SELECT " ) ;
appendPQExpBufferStr ( query , " SELECT " ) ;
if ( fout - > remoteVersion > = 100000 )
appendPQExpBuffer ( query ,
appendPQExpBufferStr ( query ,
" collprovider, "
" collversion, " ) ;
else
appendPQExpBuffer ( query ,
appendPQExpBufferStr ( query ,
" 'c' AS collprovider, "
" NULL AS collversion, " ) ;
if ( fout - > remoteVersion > = 120000 )
appendPQExpBuffer ( query ,
appendPQExpBufferStr ( query ,
" collisdeterministic, " ) ;
else
appendPQExpBuffer ( query ,
appendPQExpBufferStr ( query ,
" true AS collisdeterministic, " ) ;
appendPQExpBuffer ( query ,
@ -13665,7 +13665,7 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
appendPQExpBufferStr ( & buf , agginfo - > aggfn . dobj . name ) ;
if ( agginfo - > aggfn . nargs = = 0 )
appendPQExpBuffer ( & buf , " (*) " ) ;
appendPQExpBufferStr ( & buf , " (*) " ) ;
else
{
appendPQExpBufferChar ( & buf , ' ( ' ) ;
@ -14883,13 +14883,13 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
*/
if ( strlen ( initacls ) ! = 0 | | strlen ( initracls ) ! = 0 )
{
appendPQExpBuffer ( sql , " SELECT pg_catalog.binary_upgrade_set_record_init_privs(true); \n " ) ;
appendPQExpBufferStr ( sql , " SELECT pg_catalog.binary_upgrade_set_record_init_privs(true); \n " ) ;
if ( ! buildACLCommands ( name , subname , nspname , type ,
initacls , initracls , owner ,
" " , fout - > remoteVersion , sql ) )
fatal ( " could not parse initial GRANT ACL list (%s) or initial REVOKE ACL list (%s) for object \" %s \" (%s) " ,
initacls , initracls , name , type ) ;
appendPQExpBuffer ( sql , " SELECT pg_catalog.binary_upgrade_set_record_init_privs(false); \n " ) ;
appendPQExpBufferStr ( sql , " SELECT pg_catalog.binary_upgrade_set_record_init_privs(false); \n " ) ;
}
if ( ! buildACLCommands ( name , subname , nspname , type ,
@ -16591,7 +16591,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
}
if ( indxinfo - > indnkeyattrs < indxinfo - > indnattrs )
appendPQExpBuffer ( q , " ) INCLUDE ( " ) ;
appendPQExpBufferStr ( q , " ) INCLUDE ( " ) ;
for ( k = indxinfo - > indnkeyattrs ; k < indxinfo - > indnattrs ; k + + )
{
@ -16988,9 +16988,9 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
" ALTER COLUMN %s ADD GENERATED " ,
fmtId ( owning_tab - > attnames [ tbinfo - > owning_col - 1 ] ) ) ;
if ( owning_tab - > attidentity [ tbinfo - > owning_col - 1 ] = = ATTRIBUTE_IDENTITY_ALWAYS )
appendPQExpBuffer ( query , " ALWAYS " ) ;
appendPQExpBufferStr ( query , " ALWAYS " ) ;
else if ( owning_tab - > attidentity [ tbinfo - > owning_col - 1 ] = = ATTRIBUTE_IDENTITY_BY_DEFAULT )
appendPQExpBuffer ( query , " BY DEFAULT " ) ;
appendPQExpBufferStr ( query , " BY DEFAULT " ) ;
appendPQExpBuffer ( query , " AS IDENTITY ( \n SEQUENCE NAME %s \n " ,
fmtQualifiedDumpable ( tbinfo ) ) ;
}