Use C99 designated initializers for some structs

These are just a few particularly egregious cases that were hard to read
and write, and error prone because of many similar adjacent types.

Discussion: https://www.postgresql.org/message-id/flat/4c9f01be-9245-2148-b569-61a8562ef190%402ndquadrant.com
This commit is contained in:
Peter Eisentraut 2018-08-29 08:36:30 +02:00
parent 75f7855369
commit 98afa68d93
8 changed files with 240 additions and 505 deletions

View File

@ -199,27 +199,8 @@ typedef TransactionStateData *TransactionState;
* transaction at all, or when in a top-level transaction. * transaction at all, or when in a top-level transaction.
*/ */
static TransactionStateData TopTransactionStateData = { static TransactionStateData TopTransactionStateData = {
0, /* transaction id */ .state = TRANS_DEFAULT,
0, /* subtransaction id */ .blockState = TBLOCK_DEFAULT,
NULL, /* savepoint name */
0, /* savepoint level */
TRANS_DEFAULT, /* transaction state */
TBLOCK_DEFAULT, /* transaction block state from the client
* perspective */
0, /* transaction nesting depth */
0, /* GUC context nesting depth */
NULL, /* cur transaction context */
NULL, /* cur transaction resource owner */
NULL, /* subcommitted child Xids */
0, /* # of subcommitted child Xids */
0, /* allocated size of childXids[] */
InvalidOid, /* previous CurrentUserId setting */
0, /* previous SecurityRestrictionContext */
false, /* entry-time xact r/o state */
false, /* startedInRecovery */
false, /* didLogXid */
0, /* parallelModeLevel */
NULL /* link to parent state block */
}; };
/* /*

View File

@ -145,39 +145,87 @@ static List *insert_ordered_unique_oid(List *list, Oid datum);
*/ */
static FormData_pg_attribute a1 = { static FormData_pg_attribute a1 = {
0, {"ctid"}, TIDOID, 0, sizeof(ItemPointerData), .attname = {"ctid"},
SelfItemPointerAttributeNumber, 0, -1, -1, .atttypid = TIDOID,
false, 'p', 's', true, false, false, '\0', false, true, 0 .attlen = sizeof(ItemPointerData),
.attnum = SelfItemPointerAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = false,
.attstorage = 'p',
.attalign = 's',
.attnotnull = true,
.attislocal = true,
}; };
static FormData_pg_attribute a2 = { static FormData_pg_attribute a2 = {
0, {"oid"}, OIDOID, 0, sizeof(Oid), .attname = {"oid"},
ObjectIdAttributeNumber, 0, -1, -1, .atttypid = OIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(Oid),
.attnum = ObjectIdAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
static FormData_pg_attribute a3 = { static FormData_pg_attribute a3 = {
0, {"xmin"}, XIDOID, 0, sizeof(TransactionId), .attname = {"xmin"},
MinTransactionIdAttributeNumber, 0, -1, -1, .atttypid = XIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(TransactionId),
.attnum = MinTransactionIdAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
static FormData_pg_attribute a4 = { static FormData_pg_attribute a4 = {
0, {"cmin"}, CIDOID, 0, sizeof(CommandId), .attname = {"cmin"},
MinCommandIdAttributeNumber, 0, -1, -1, .atttypid = CIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(CommandId),
.attnum = MinCommandIdAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
static FormData_pg_attribute a5 = { static FormData_pg_attribute a5 = {
0, {"xmax"}, XIDOID, 0, sizeof(TransactionId), .attname = {"xmax"},
MaxTransactionIdAttributeNumber, 0, -1, -1, .atttypid = XIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(TransactionId),
.attnum = MaxTransactionIdAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
static FormData_pg_attribute a6 = { static FormData_pg_attribute a6 = {
0, {"cmax"}, CIDOID, 0, sizeof(CommandId), .attname = {"cmax"},
MaxCommandIdAttributeNumber, 0, -1, -1, .atttypid = CIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(CommandId),
.attnum = MaxCommandIdAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
/* /*
@ -187,9 +235,17 @@ static FormData_pg_attribute a6 = {
* used in SQL. * used in SQL.
*/ */
static FormData_pg_attribute a7 = { static FormData_pg_attribute a7 = {
0, {"tableoid"}, OIDOID, 0, sizeof(Oid), .attname = {"tableoid"},
TableOidAttributeNumber, 0, -1, -1, .atttypid = OIDOID,
true, 'p', 'i', true, false, false, '\0', false, true, 0 .attlen = sizeof(Oid),
.attnum = TableOidAttributeNumber,
.attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attstorage = 'p',
.attalign = 'i',
.attnotnull = true,
.attislocal = true,
}; };
static const Form_pg_attribute SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7}; static const Form_pg_attribute SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7};

View File

@ -391,418 +391,222 @@ do { \
static const SchemaQuery Query_for_list_of_aggregates[] = { static const SchemaQuery Query_for_list_of_aggregates[] = {
{ {
/* min_server_version */ .min_server_version = 110000,
110000, .catname = "pg_catalog.pg_proc p",
/* catname */ .selcondition = "p.prokind = 'a'",
"pg_catalog.pg_proc p", .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
/* selcondition */ .namespace = "p.pronamespace",
"p.prokind = 'a'", .result = "pg_catalog.quote_ident(p.proname)",
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
}, },
{ {
/* min_server_version */ .catname = "pg_catalog.pg_proc p",
0, .selcondition = "p.proisagg",
/* catname */ .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
"pg_catalog.pg_proc p", .namespace = "p.pronamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(p.proname)",
"p.proisagg",
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
} }
}; };
static const SchemaQuery Query_for_list_of_datatypes = { static const SchemaQuery Query_for_list_of_datatypes = {
/* min_server_version */ .catname = "pg_catalog.pg_type t",
0,
/* catname */
"pg_catalog.pg_type t",
/* selcondition --- ignore table rowtypes and array types */ /* selcondition --- ignore table rowtypes and array types */
"(t.typrelid = 0 " .selcondition = "(t.typrelid = 0 "
" OR (SELECT c.relkind = " CppAsString2(RELKIND_COMPOSITE_TYPE) " OR (SELECT c.relkind = " CppAsString2(RELKIND_COMPOSITE_TYPE)
" FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid)) " " FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid)) "
"AND t.typname !~ '^_'", "AND t.typname !~ '^_'",
/* viscondition */ .viscondition = "pg_catalog.pg_type_is_visible(t.oid)",
"pg_catalog.pg_type_is_visible(t.oid)", .namespace = "t.typnamespace",
/* namespace */ .result = "pg_catalog.format_type(t.oid, NULL)",
"t.typnamespace", .qualresult = "pg_catalog.quote_ident(t.typname)",
/* result */
"pg_catalog.format_type(t.oid, NULL)",
/* qualresult */
"pg_catalog.quote_ident(t.typname)"
}; };
static const SchemaQuery Query_for_list_of_domains = { static const SchemaQuery Query_for_list_of_domains = {
/* min_server_version */ .catname = "pg_catalog.pg_type t",
0, .selcondition = "t.typtype = 'd'",
/* catname */ .viscondition = "pg_catalog.pg_type_is_visible(t.oid)",
"pg_catalog.pg_type t", .namespace = "t.typnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(t.typname)",
"t.typtype = 'd'",
/* viscondition */
"pg_catalog.pg_type_is_visible(t.oid)",
/* namespace */
"t.typnamespace",
/* result */
"pg_catalog.quote_ident(t.typname)",
/* qualresult */
NULL
}; };
/* Note: this intentionally accepts aggregates as well as plain functions */ /* Note: this intentionally accepts aggregates as well as plain functions */
static const SchemaQuery Query_for_list_of_functions[] = { static const SchemaQuery Query_for_list_of_functions[] = {
{ {
/* min_server_version */ .min_server_version = 110000,
110000, .catname = "pg_catalog.pg_proc p",
/* catname */ .selcondition = "p.prokind != 'p'",
"pg_catalog.pg_proc p", .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
/* selcondition */ .namespace = "p.pronamespace",
"p.prokind != 'p'", .result = "pg_catalog.quote_ident(p.proname)",
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
}, },
{ {
/* min_server_version */ .catname = "pg_catalog.pg_proc p",
0, .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
/* catname */ .namespace = "p.pronamespace",
"pg_catalog.pg_proc p", .result = "pg_catalog.quote_ident(p.proname)",
/* selcondition */
NULL,
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
} }
}; };
static const SchemaQuery Query_for_list_of_indexes = { static const SchemaQuery Query_for_list_of_indexes = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_INDEX) ", " "c.relkind IN (" CppAsString2(RELKIND_INDEX) ", "
CppAsString2(RELKIND_PARTITIONED_INDEX) ")", CppAsString2(RELKIND_PARTITIONED_INDEX) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_procedures[] = { static const SchemaQuery Query_for_list_of_procedures[] = {
{ {
/* min_server_version */ .min_server_version = 110000,
110000, .catname = "pg_catalog.pg_proc p",
/* catname */ .selcondition = "p.prokind = 'p'",
"pg_catalog.pg_proc p", .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
/* selcondition */ .namespace = "p.pronamespace",
"p.prokind = 'p'", .result = "pg_catalog.quote_ident(p.proname)",
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
}, },
{0, NULL} {
/* not supported in older versions */
.catname = NULL,
}
}; };
static const SchemaQuery Query_for_list_of_routines = { static const SchemaQuery Query_for_list_of_routines = {
/* min_server_version */ .catname = "pg_catalog.pg_proc p",
0, .viscondition = "pg_catalog.pg_function_is_visible(p.oid)",
/* catname */ .namespace = "p.pronamespace",
"pg_catalog.pg_proc p", .result = "pg_catalog.quote_ident(p.proname)",
/* selcondition */
NULL,
/* viscondition */
"pg_catalog.pg_function_is_visible(p.oid)",
/* namespace */
"p.pronamespace",
/* result */
"pg_catalog.quote_ident(p.proname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_sequences = { static const SchemaQuery Query_for_list_of_sequences = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition = "c.relkind IN (" CppAsString2(RELKIND_SEQUENCE) ")",
/* catname */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_class c", .namespace = "c.relnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relkind IN (" CppAsString2(RELKIND_SEQUENCE) ")",
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_foreign_tables = { static const SchemaQuery Query_for_list_of_foreign_tables = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition = "c.relkind IN (" CppAsString2(RELKIND_FOREIGN_TABLE) ")",
/* catname */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_class c", .namespace = "c.relnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relkind IN (" CppAsString2(RELKIND_FOREIGN_TABLE) ")",
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_tables = { static const SchemaQuery Query_for_list_of_tables = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_PARTITIONED_TABLE) ")", CppAsString2(RELKIND_PARTITIONED_TABLE) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_partitioned_tables = { static const SchemaQuery Query_for_list_of_partitioned_tables = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition = "c.relkind IN (" CppAsString2(RELKIND_PARTITIONED_TABLE) ")",
/* catname */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_class c", .namespace = "c.relnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relkind IN (" CppAsString2(RELKIND_PARTITIONED_TABLE) ")",
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_constraints_with_schema = { static const SchemaQuery Query_for_list_of_constraints_with_schema = {
/* min_server_version */ .catname = "pg_catalog.pg_constraint c",
0, .selcondition = "c.conrelid <> 0",
/* catname */ .viscondition = "true", /* there is no pg_constraint_is_visible */
"pg_catalog.pg_constraint c", .namespace = "c.connamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.conname)",
"c.conrelid <> 0",
/* viscondition */
"true", /* there is no pg_constraint_is_visible */
/* namespace */
"c.connamespace",
/* result */
"pg_catalog.quote_ident(c.conname)",
/* qualresult */
NULL
}; };
/* Relations supporting INSERT, UPDATE or DELETE */ /* Relations supporting INSERT, UPDATE or DELETE */
static const SchemaQuery Query_for_list_of_updatables = { static const SchemaQuery Query_for_list_of_updatables = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_FOREIGN_TABLE) ", " CppAsString2(RELKIND_FOREIGN_TABLE) ", "
CppAsString2(RELKIND_VIEW) ", " CppAsString2(RELKIND_VIEW) ", "
CppAsString2(RELKIND_PARTITIONED_TABLE) ")", CppAsString2(RELKIND_PARTITIONED_TABLE) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_relations = { static const SchemaQuery Query_for_list_of_relations = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
/* catname */ .namespace = "c.relnamespace",
"pg_catalog.pg_class c", .result = "pg_catalog.quote_ident(c.relname)",
/* selcondition */
NULL,
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_tsvmf = { static const SchemaQuery Query_for_list_of_tsvmf = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_SEQUENCE) ", " CppAsString2(RELKIND_SEQUENCE) ", "
CppAsString2(RELKIND_VIEW) ", " CppAsString2(RELKIND_VIEW) ", "
CppAsString2(RELKIND_MATVIEW) ", " CppAsString2(RELKIND_MATVIEW) ", "
CppAsString2(RELKIND_FOREIGN_TABLE) ", " CppAsString2(RELKIND_FOREIGN_TABLE) ", "
CppAsString2(RELKIND_PARTITIONED_TABLE) ")", CppAsString2(RELKIND_PARTITIONED_TABLE) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_tmf = { static const SchemaQuery Query_for_list_of_tmf = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_MATVIEW) ", " CppAsString2(RELKIND_MATVIEW) ", "
CppAsString2(RELKIND_FOREIGN_TABLE) ")", CppAsString2(RELKIND_FOREIGN_TABLE) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_tpm = { static const SchemaQuery Query_for_list_of_tpm = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_PARTITIONED_TABLE) ", " CppAsString2(RELKIND_PARTITIONED_TABLE) ", "
CppAsString2(RELKIND_MATVIEW) ")", CppAsString2(RELKIND_MATVIEW) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_tm = { static const SchemaQuery Query_for_list_of_tm = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition =
/* catname */
"pg_catalog.pg_class c",
/* selcondition */
"c.relkind IN (" CppAsString2(RELKIND_RELATION) ", " "c.relkind IN (" CppAsString2(RELKIND_RELATION) ", "
CppAsString2(RELKIND_MATVIEW) ")", CppAsString2(RELKIND_MATVIEW) ")",
/* viscondition */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_table_is_visible(c.oid)", .namespace = "c.relnamespace",
/* namespace */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_views = { static const SchemaQuery Query_for_list_of_views = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition = "c.relkind IN (" CppAsString2(RELKIND_VIEW) ")",
/* catname */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_class c", .namespace = "c.relnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relkind IN (" CppAsString2(RELKIND_VIEW) ")",
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_matviews = { static const SchemaQuery Query_for_list_of_matviews = {
/* min_server_version */ .catname = "pg_catalog.pg_class c",
0, .selcondition = "c.relkind IN (" CppAsString2(RELKIND_MATVIEW) ")",
/* catname */ .viscondition = "pg_catalog.pg_table_is_visible(c.oid)",
"pg_catalog.pg_class c", .namespace = "c.relnamespace",
/* selcondition */ .result = "pg_catalog.quote_ident(c.relname)",
"c.relkind IN (" CppAsString2(RELKIND_MATVIEW) ")",
/* viscondition */
"pg_catalog.pg_table_is_visible(c.oid)",
/* namespace */
"c.relnamespace",
/* result */
"pg_catalog.quote_ident(c.relname)",
/* qualresult */
NULL
}; };
static const SchemaQuery Query_for_list_of_statistics = { static const SchemaQuery Query_for_list_of_statistics = {
/* min_server_version */ .catname = "pg_catalog.pg_statistic_ext s",
0, .viscondition = "pg_catalog.pg_statistics_obj_is_visible(s.oid)",
/* catname */ .namespace = "s.stxnamespace",
"pg_catalog.pg_statistic_ext s", .result = "pg_catalog.quote_ident(s.stxname)",
/* selcondition */
NULL,
/* viscondition */
"pg_catalog.pg_statistics_obj_is_visible(s.oid)",
/* namespace */
"s.stxnamespace",
/* result */
"pg_catalog.quote_ident(s.stxname)",
/* qualresult */
NULL
}; };

View File

@ -43,37 +43,14 @@ static PyMethodDef PLy_cursor_methods[] = {
static PyTypeObject PLy_CursorType = { static PyTypeObject PLy_CursorType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"PLyCursor", /* tp_name */ .tp_name = "PLyCursor",
sizeof(PLyCursorObject), /* tp_size */ .tp_basicsize = sizeof(PLyCursorObject),
0, /* tp_itemsize */ .tp_dealloc = PLy_cursor_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_ITER,
/* .tp_doc = PLy_cursor_doc,
* methods .tp_iter = PyObject_SelfIter,
*/ .tp_iternext = PLy_cursor_iternext,
PLy_cursor_dealloc, /* tp_dealloc */ .tp_methods = PLy_cursor_methods,
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_ITER, /* tp_flags */
PLy_cursor_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
PLy_cursor_iternext, /* tp_iternext */
PLy_cursor_methods, /* tp_tpmethods */
}; };
void void

View File

@ -34,37 +34,12 @@ static PyMethodDef PLy_plan_methods[] = {
static PyTypeObject PLy_PlanType = { static PyTypeObject PLy_PlanType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"PLyPlan", /* tp_name */ .tp_name = "PLyPlan",
sizeof(PLyPlanObject), /* tp_size */ .tp_basicsize = sizeof(PLyPlanObject),
0, /* tp_itemsize */ .tp_dealloc = PLy_plan_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
/* .tp_doc = PLy_plan_doc,
* methods .tp_methods = PLy_plan_methods,
*/
PLy_plan_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PLy_plan_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PLy_plan_methods, /* tp_tpmethods */
}; };
void void

View File

@ -115,23 +115,17 @@ static PyMethodDef PLy_exc_methods[] = {
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static PyModuleDef PLy_module = { static PyModuleDef PLy_module = {
PyModuleDef_HEAD_INIT, /* m_base */ PyModuleDef_HEAD_INIT,
"plpy", /* m_name */ .m_name = "plpy",
NULL, /* m_doc */ .m_size = -1,
-1, /* m_size */ .m_methods = PLy_methods,
PLy_methods, /* m_methods */
}; };
static PyModuleDef PLy_exc_module = { static PyModuleDef PLy_exc_module = {
PyModuleDef_HEAD_INIT, /* m_base */ PyModuleDef_HEAD_INIT,
"spiexceptions", /* m_name */ .m_name = "spiexceptions",
NULL, /* m_doc */ .m_size = -1,
-1, /* m_size */ .m_methods = PLy_exc_methods,
PLy_exc_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
}; };
/* /*

View File

@ -29,19 +29,14 @@ static char PLy_result_doc[] = {
}; };
static PySequenceMethods PLy_result_as_sequence = { static PySequenceMethods PLy_result_as_sequence = {
PLy_result_length, /* sq_length */ .sq_length = PLy_result_length,
NULL, /* sq_concat */ .sq_item = PLy_result_item,
NULL, /* sq_repeat */
PLy_result_item, /* sq_item */
NULL, /* sq_slice */
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
}; };
static PyMappingMethods PLy_result_as_mapping = { static PyMappingMethods PLy_result_as_mapping = {
PLy_result_length, /* mp_length */ .mp_length = PLy_result_length,
PLy_result_subscript, /* mp_subscript */ .mp_subscript = PLy_result_subscript,
PLy_result_ass_subscript, /* mp_ass_subscript */ .mp_ass_subscript = PLy_result_ass_subscript,
}; };
static PyMethodDef PLy_result_methods[] = { static PyMethodDef PLy_result_methods[] = {
@ -55,37 +50,15 @@ static PyMethodDef PLy_result_methods[] = {
static PyTypeObject PLy_ResultType = { static PyTypeObject PLy_ResultType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"PLyResult", /* tp_name */ .tp_name = "PLyResult",
sizeof(PLyResultObject), /* tp_size */ .tp_basicsize = sizeof(PLyResultObject),
0, /* tp_itemsize */ .tp_dealloc = PLy_result_dealloc,
.tp_as_sequence = &PLy_result_as_sequence,
/* .tp_as_mapping = &PLy_result_as_mapping,
* methods .tp_str = &PLy_result_str,
*/ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PLy_result_dealloc, /* tp_dealloc */ .tp_doc = PLy_result_doc,
0, /* tp_print */ .tp_methods = PLy_result_methods,
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
&PLy_result_as_sequence, /* tp_as_sequence */
&PLy_result_as_mapping, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
&PLy_result_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PLy_result_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PLy_result_methods, /* tp_tpmethods */
}; };
void void

View File

@ -38,37 +38,12 @@ static PyMethodDef PLy_subtransaction_methods[] = {
static PyTypeObject PLy_SubtransactionType = { static PyTypeObject PLy_SubtransactionType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"PLySubtransaction", /* tp_name */ .tp_name = "PLySubtransaction",
sizeof(PLySubtransactionObject), /* tp_size */ .tp_basicsize = sizeof(PLySubtransactionObject),
0, /* tp_itemsize */ .tp_dealloc = PLy_subtransaction_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
/* .tp_doc = PLy_subtransaction_doc,
* methods .tp_methods = PLy_subtransaction_methods,
*/
PLy_subtransaction_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PLy_subtransaction_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PLy_subtransaction_methods, /* tp_tpmethods */
}; };