Skip to content

Commit 996414d

Browse files
committed
oid fixes
1 parent 3648854 commit 996414d

File tree

12 files changed

+43
-82
lines changed

12 files changed

+43
-82
lines changed

src/backend/access/compression/cm_pglz.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ pglz_cmdecompress(CompressionAmOptions *cmoptions, const struct varlena *value)
140140
Assert(VARATT_IS_CUSTOM_COMPRESSED(value));
141141
result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ);
142142

143-
SET_VARSIZE(result, resultlen);
144143
rawsize = pglz_decompress((char *) value + VARHDRSZ_CUSTOM_COMPRESSED,
145144
VARSIZE(value) - VARHDRSZ_CUSTOM_COMPRESSED,
146145
VARDATA(result),

src/backend/access/heap/tuptoaster.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,6 +2443,8 @@ toast_decompress_datum(struct varlena *attr)
24432443
}
24442444
else
24452445
{
2446+
int rawsize;
2447+
24462448
result = (struct varlena *)
24472449
palloc(TOAST_COMPRESS_RAWSIZE(attr) + VARHDRSZ);
24482450
SET_VARSIZE(result, TOAST_COMPRESS_RAWSIZE(attr) + VARHDRSZ);

src/backend/commands/copy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ CopyMultiInsertBufferInit(ResultRelInfo *rri)
23542354
buffer = (CopyMultiInsertBuffer *) palloc(sizeof(CopyMultiInsertBuffer));
23552355
memset(buffer->slots, 0, sizeof(TupleTableSlot *) * MAX_BUFFERED_TUPLES);
23562356
buffer->resultRelInfo = rri;
2357-
buffer->bistate = GetBulkInsertState();
2357+
buffer->bistate = GetBulkInsertState(NULL);
23582358
buffer->nused = 0;
23592359

23602360
return buffer;
@@ -2975,7 +2975,7 @@ CopyFrom(CopyState cstate)
29752975
{
29762976
singleslot = table_slot_create(resultRelInfo->ri_RelationDesc,
29772977
&estate->es_tupleTable);
2978-
bistate = GetBulkInsertState();
2978+
bistate = GetBulkInsertState(NULL);
29792979
}
29802980

29812981
has_before_insert_row_trig = (resultRelInfo->ri_TrigDesc &&
@@ -2992,7 +2992,6 @@ CopyFrom(CopyState cstate)
29922992
*/
29932993
ExecBSInsertTriggers(estate, resultRelInfo);
29942994

2995-
bistate = GetBulkInsertState(NULL);
29962995
econtext = GetPerTupleExprContext(estate);
29972996

29982997
/* Set up callback to identify error line number */

src/backend/commands/tablecmds.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10183,37 +10183,6 @@ createForeignKeyCheckTriggers(Oid myRelOid, Oid refRelOid,
1018310183
indexOid, false);
1018410184
}
1018510185

10186-
/*
10187-
* Create the triggers that implement an FK constraint.
10188-
*
10189-
* NB: if you change any trigger properties here, see also
10190-
* ATExecAlterConstraint.
10191-
*/
10192-
void
10193-
createForeignKeyTriggers(Relation rel, Oid refRelOid, Constraint *fkconstraint,
10194-
Oid constraintOid, Oid indexOid, bool create_action)
10195-
{
10196-
/*
10197-
* For the referenced side, create action triggers, if requested. (If the
10198-
* referencing side is partitioned, there is still only one trigger, which
10199-
* runs on the referenced side and points to the top of the referencing
10200-
* hierarchy.)
10201-
*/
10202-
if (create_action)
10203-
createForeignKeyActionTriggers(rel, refRelOid, fkconstraint, constraintOid,
10204-
indexOid);
10205-
10206-
/*
10207-
* For the referencing side, create the check triggers. We only need
10208-
* these on the partitions.
10209-
*/
10210-
if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
10211-
createForeignKeyCheckTriggers(RelationGetRelid(rel), refRelOid,
10212-
fkconstraint, constraintOid, indexOid);
10213-
10214-
CommandCounterIncrement();
10215-
}
10216-
1021710186
/*
1021810187
* Initialize hash table used to keep rewrite rules for
1021910188
* compression changes in ALTER commands.

src/bin/pg_dump/pg_dump.c

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8669,10 +8669,9 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
86698669
int i_curattnum;
86708670
int start;
86718671

8672-
if (g_verbose)
8673-
write_msg(NULL, "finding compression info for table \"%s.%s\"\n",
8674-
tbinfo->dobj.namespace->dobj.name,
8675-
tbinfo->dobj.name);
8672+
pg_log_info("finding compression info for table \"%s.%s\"",
8673+
tbinfo->dobj.namespace->dobj.name,
8674+
tbinfo->dobj.name);
86768675

86778676
tbinfo->attcompression = pg_malloc0(tbinfo->numatts * sizeof(AttrCompressionInfo *));
86788677

@@ -15821,6 +15820,25 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1582115820
tbinfo->atttypnames[j]);
1582215821
}
1582315822

15823+
/*
15824+
* Compression
15825+
*
15826+
* In binary-upgrade mode, compression is assigned by
15827+
* ALTER. Even if we're skipping compression the attribute
15828+
* will get default compression. It's the task for ALTER
15829+
* command to restore compression info.
15830+
*/
15831+
if (!dopt->no_compression_methods && !dopt->binary_upgrade &&
15832+
tbinfo->attcmnames[j] && strlen(tbinfo->attcmnames[j]) &&
15833+
has_custom_compression)
15834+
{
15835+
appendPQExpBuffer(q, " COMPRESSION %s",
15836+
tbinfo->attcmnames[j]);
15837+
if (nonemptyReloptions(tbinfo->attcmoptions[j]))
15838+
appendPQExpBuffer(q, " WITH (%s)",
15839+
tbinfo->attcmoptions[j]);
15840+
}
15841+
1582415842
if (print_default)
1582515843
{
1582615844
if (tbinfo->attgenerated[j] == ATTRIBUTE_GENERATED_STORED)
@@ -15845,32 +15863,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1584515863
appendPQExpBuffer(q, " COLLATE %s",
1584615864
fmtQualifiedDumpable(coll));
1584715865
}
15848-
15849-
/*
15850-
* Compression
15851-
*
15852-
* In binary-upgrade mode, compression is assigned by
15853-
* ALTER. Even if we're skipping compression the attribute
15854-
* will get default compression. It's the task for ALTER
15855-
* command to restore compression info.
15856-
*/
15857-
if (!dopt->no_compression_methods && !dopt->binary_upgrade &&
15858-
tbinfo->attcmnames[j] && strlen(tbinfo->attcmnames[j]) &&
15859-
has_custom_compression)
15860-
{
15861-
appendPQExpBuffer(q, " COMPRESSION %s",
15862-
tbinfo->attcmnames[j]);
15863-
if (nonemptyReloptions(tbinfo->attcmoptions[j]))
15864-
appendPQExpBuffer(q, " WITH (%s)",
15865-
tbinfo->attcmoptions[j]);
15866-
}
15867-
15868-
if (has_default)
15869-
appendPQExpBuffer(q, " DEFAULT %s",
15870-
tbinfo->attrdefs[j]->adef_expr);
15871-
15872-
if (has_notnull)
15873-
appendPQExpBufferStr(q, " NOT NULL");
1587415866
}
1587515867
}
1587615868

src/include/catalog/indexing.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using b
9090
DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops));
9191
#define AttrDefaultOidIndexId 2657
9292

93-
DECLARE_UNIQUE_INDEX(pg_attr_compression_index, 4003, on pg_attr_compression using btree(acoid oid_ops));
94-
#define AttrCompressionIndexId 4003
95-
DECLARE_INDEX(pg_attr_compression_relid_attnum_index, 4004, on pg_attr_compression using btree(acrelid oid_ops, acattnum int2_ops));
96-
#define AttrCompressionRelidAttnumIndexId 4004
93+
DECLARE_UNIQUE_INDEX(pg_attr_compression_index, 2030, on pg_attr_compression using btree(acoid oid_ops));
94+
#define AttrCompressionIndexId 2030
95+
DECLARE_INDEX(pg_attr_compression_relid_attnum_index, 2121, on pg_attr_compression using btree(acrelid oid_ops, acattnum int2_ops));
96+
#define AttrCompressionRelidAttnumIndexId 2121
9797

9898
DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, on pg_attribute using btree(attrelid oid_ops, attname name_ops));
9999
#define AttributeRelidNameIndexId 2658

src/include/catalog/pg_am.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
{ oid => '3580', oid_symbol => 'BRIN_AM_OID',
3434
descr => 'block range index (BRIN) access method',
3535
amname => 'brin', amhandler => 'brinhandler', amtype => 'i' },
36-
{ oid => '4002', oid_symbol => 'PGLZ_COMPRESSION_AM_OID',
36+
{ oid => '4191', oid_symbol => 'PGLZ_COMPRESSION_AM_OID',
3737
descr => 'pglz compression access method',
3838
amname => 'pglz', amhandler => 'pglzhandler', amtype => 'c' },
39-
{ oid => '4011', oid_symbol => 'ZLIB_COMPRESSION_AM_OID',
39+
{ oid => '4192', oid_symbol => 'ZLIB_COMPRESSION_AM_OID',
4040
descr => 'zlib compression access method',
4141
amname => 'zlib', amhandler => 'zlibhandler', amtype => 'c' },
4242

src/include/catalog/pg_attr_compression.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
[
2020

21-
{ acoid => '4002', acname => 'pglz' },
22-
{ acoid => '4011', acname => 'zlib' },
21+
{ acoid => '4191', acname => 'pglz' },
22+
{ acoid => '4192', acname => 'zlib' },
2323

2424
]

src/include/catalog/pg_attr_compression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* typedef struct FormData_pg_attr_compression
2626
* ----------------
2727
*/
28-
CATALOG(pg_attr_compression,4001,AttrCompressionRelationId)
28+
CATALOG(pg_attr_compression,4189,AttrCompressionRelationId)
2929
{
3030
Oid acoid; /* attribute compression oid */
3131
NameData acname; /* name of compression AM */

src/include/catalog/pg_class.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
relname => 'pg_attribute', reltype => 'pg_attribute', relam => 'heap',
3535
relfilenode => '0', relpages => '0', reltuples => '0', relallvisible => '0',
3636
reltoastrelid => '0', relhasindex => 'f', relisshared => 'f',
37-
relpersistence => 'p', relkind => 'r', relnatts => '25', relchecks => '0',
37+
relpersistence => 'p', relkind => 'r', relnatts => '26', relchecks => '0',
3838
relhasrules => 'f', relhastriggers => 'f', relhassubclass => 'f',
3939
relrowsecurity => 'f', relforcerowsecurity => 'f', relispopulated => 't',
4040
relreplident => 'n', relispartition => 'f', relfrozenxid => '3',

0 commit comments

Comments
 (0)