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

Commit9373baa

Browse files
committed
Minor edits to catalog files and scripts
This fixes a few typos and small mistakes; it also cleans a fewminor stylistic issues. The biggest functional change is thatGen_fmgrtab.pl no longer knows the OID of language 'internal'.Author: John NaylorDiscussion:https://postgr.es/m/CAJVSVGXAkwbk-A9QHHHf00N905kKisyQbaYwKqaRpze_gPXGfg@mail.gmail.com
1 parentcce1ecf commit9373baa

File tree

8 files changed

+62
-55
lines changed

8 files changed

+62
-55
lines changed

‎src/backend/catalog/Catalog.pm

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ package Catalog;
1616
use strict;
1717
use warnings;
1818

19-
require Exporter;
20-
our@ISA =qw(Exporter);
21-
our@EXPORT = ();
22-
our@EXPORT_OK =qw(Catalogs SplitDataLine RenameTempFile FindDefinedSymbol);
23-
2419
# Call this function with an array of names of header files to parse.
2520
# Returns a nested data structure describing the data in the headers.
2621
subCatalogs
@@ -36,7 +31,8 @@ sub Catalogs
3631
'int64'=>'int8',
3732
'Oid'=>'oid',
3833
'NameData'=>'name',
39-
'TransactionId'=>'xid');
34+
'TransactionId'=>'xid',
35+
'XLogRecPtr'=>'pg_lsn');
4036

4137
foreachmy$input_file (@_)
4238
{
@@ -162,7 +158,7 @@ sub Catalogs
162158
/BKI_WITHOUT_OIDS/ ?' without_oids' :'';
163159
$catalog{rowtype_oid} =
164160
/BKI_ROWTYPE_OID\((\d+)\)/ ?" rowtype_oid$1" :'';
165-
$catalog{schema_macro} = /BKI_SCHEMA_MACRO/ ?'True' :'';
161+
$catalog{schema_macro} = /BKI_SCHEMA_MACRO/ ?1 :0;
166162
$declaring_attributes = 1;
167163
}
168164
elsif ($declaring_attributes)
@@ -175,7 +171,7 @@ sub Catalogs
175171
}
176172
else
177173
{
178-
my%row;
174+
my%column;
179175
my ($atttype,$attname,$attopt) =split /\s+/,$_;
180176
die"parse error ($input_file)"unless$attname;
181177
if (exists$RENAME_ATTTYPE{$atttype})
@@ -188,26 +184,26 @@ sub Catalogs
188184
$atttype .='[]';# variable-length only
189185
}
190186

191-
$row{'type'} =$atttype;
192-
$row{'name'} =$attname;
187+
$column{type} =$atttype;
188+
$column{name} =$attname;
193189

194190
if (defined$attopt)
195191
{
196192
if ($attopteq'BKI_FORCE_NULL')
197193
{
198-
$row{'forcenull'} = 1;
194+
$column{forcenull} = 1;
199195
}
200196
elsif ($attopteq'BKI_FORCE_NOT_NULL')
201197
{
202-
$row{'forcenotnull'} = 1;
198+
$column{forcenotnull} = 1;
203199
}
204200
else
205201
{
206202
die
207203
"unknown column option$attopt on column$attname";
208204
}
209205
}
210-
push @{$catalog{columns} }, \%row;
206+
push @{$catalog{columns} }, \%column;
211207
}
212208
}
213209
}

‎src/backend/catalog/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\
4545
pg_default_acl.h pg_init_privs.h pg_seclabel.h pg_shseclabel.h \
4646
pg_collation.h pg_partitioned_table.h pg_range.h pg_transform.h \
4747
pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \
48-
pg_subscription_rel.htoasting.h indexing.h\
48+
pg_subscription_rel.h \
4949
toasting.h indexing.h \
5050
)
5151

‎src/backend/catalog/genbki.pl

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use warnings;
2121

2222
my@input_files;
23-
our@include_path;
23+
my@include_path;
2424
my$output_path ='';
2525
my$major_version;
2626

@@ -105,7 +105,7 @@
105105
my%schemapg_entries;
106106
my@tables_needing_macros;
107107
my%regprocoids;
108-
our@types;
108+
my@types;
109109

110110
# produce output, one catalog at a time
111111
foreachmy$catname (@{$catalogs->{names} })
@@ -124,7 +124,8 @@
124124
my$first = 1;
125125

126126
print$bki" (\n";
127-
foreachmy$column (@{$catalog->{columns} })
127+
my$schema =$catalog->{columns};
128+
foreachmy$column (@$schema)
128129
{
129130
my$attname =$column->{name};
130131
my$atttype =$column->{type};
@@ -150,8 +151,9 @@
150151
}
151152
print$bki"\n )\n";
152153

153-
# open it, unless bootstrap case (create bootstrap does this automatically)
154-
if ($catalog->{bootstrap}eq'')
154+
# Open it, unless bootstrap case (create bootstrap does this
155+
# automatically)
156+
if (!$catalog->{bootstrap})
155157
{
156158
print$bki"open$catname\n";
157159
}
@@ -169,21 +171,23 @@
169171
Catalog::SplitDataLine($row->{bki_values});
170172

171173
# Perform required substitutions on fields
172-
foreachmy$att (keys%bki_values)
174+
foreachmy$column (@$schema)
173175
{
176+
my$attname =$column->{name};
177+
my$atttype =$column->{type};
174178

175179
# Substitute constant values we acquired above.
176180
# (It's intentional that this can apply to parts of a field).
177-
$bki_values{$att} =~s/\bPGUID\b/$BOOTSTRAP_SUPERUSERID/g;
178-
$bki_values{$att} =~s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g;
181+
$bki_values{$attname} =~s/\bPGUID\b/$BOOTSTRAP_SUPERUSERID/g;
182+
$bki_values{$attname} =~s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g;
179183

180184
# Replace regproc columns' values with OIDs.
181185
# If we don't have a unique value to substitute,
182186
# just do nothing (regprocin will complain).
183-
if ($bki_attr{$att}->{type}eq'regproc')
187+
if ($atttypeeq'regproc')
184188
{
185-
my$procoid =$regprocoids{$bki_values{$att} };
186-
$bki_values{$att} =$procoid
189+
my$procoid =$regprocoids{$bki_values{$attname} };
190+
$bki_values{$attname} =$procoid
187191
ifdefined($procoid) &&$procoidne'MULTIPLE';
188192
}
189193
}
@@ -215,16 +219,17 @@
215219
printf$bki"insert%s(%s )\n",$oid,
216220
join('',@bki_values{@attnames});
217221

218-
# Write comments to postgres.description and postgres.shdescription
222+
# Write comments to postgres.description and
223+
# postgres.shdescription
219224
if (defined$row->{descr})
220225
{
221-
printf$descr"%s\t%s\t0\t%s\n",$row->{oid},$catname,
222-
$row->{descr};
226+
printf$descr"%s\t%s\t0\t%s\n",
227+
$row->{oid},$catname,$row->{descr};
223228
}
224229
if (defined$row->{shdescr})
225230
{
226-
printf$shdescr"%s\t%s\t%s\n",$row->{oid},$catname,
227-
$row->{shdescr};
231+
printf$shdescr"%s\t%s\t%s\n",
232+
$row->{oid},$catname,$row->{shdescr};
228233
}
229234
}
230235
}
@@ -240,11 +245,10 @@
240245

241246
# Currently, all bootstrapped relations also need schemapg.h
242247
# entries, so skip if the relation isn't to be in schemapg.h.
243-
nextif$table->{schema_macro}ne'True';
248+
nextif!$table->{schema_macro};
244249

245250
$schemapg_entries{$table_name} = [];
246251
push@tables_needing_macros,$table_name;
247-
my$is_bootstrap =$table->{bootstrap};
248252

249253
# Generate entries for user attributes.
250254
my$attnum = 0;
@@ -259,7 +263,7 @@
259263
$priornotnull &= ($row->{attnotnull}eq't');
260264

261265
# If it's bootstrapped, put an entry in postgres.bki.
262-
if ($is_bootstrapeq'bootstrap')
266+
if ($table->{bootstrap})
263267
{
264268
bki_insert($row,@attnames);
265269
}
@@ -268,15 +272,14 @@
268272
$row =
269273
emit_schemapg_row($row,
270274
grep {$bki_attr{$_}{type}eq'bool' }@attnames);
271-
push @{$schemapg_entries{$table_name} },'{'
272-
.join(
273-
',',grep {defined$_ }
274-
map$row->{$_},@attnames) .' }';
275+
push @{$schemapg_entries{$table_name} },
276+
sprintf"{%s }",
277+
join(',',grep {defined$_ } @{$row}{@attnames});
275278
}
276279

277280
# Generate entries for system attributes.
278281
# We only need postgres.bki entries, not schemapg.h entries.
279-
if ($is_bootstrapeq'bootstrap')
282+
if ($table->{bootstrap})
280283
{
281284
$attnum = 0;
282285
my@SYS_ATTRS = (
@@ -294,9 +297,9 @@
294297
$row->{attnum} =$attnum;
295298
$row->{attstattarget} ='0';
296299

297-
#some catalogs don't haveoids
300+
#Omit the oid column if the catalog doesn't havethem
298301
next
299-
if$table->{without_oids}eq' without_oids'
302+
if$table->{without_oids}
300303
&&$row->{attname}eq'oid';
301304

302305
bki_insert($row,@attnames);

‎src/backend/utils/Gen_fmgrtab.pl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#-------------------------------------------------------------------------
33
#
44
# Gen_fmgrtab.pl
5-
# Perl script that generates fmgroids.h and fmgrtab.c from pg_proc.h
5+
# Perl script that generates fmgroids.h, fmgrprotos.h, and fmgrtab.c
6+
# from pg_proc.h
67
#
78
# Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
89
# Portions Copyright (c) 1994, Regents of the University of California
@@ -56,6 +57,8 @@
5657

5758
my$FirstBootstrapObjectId =
5859
Catalog::FindDefinedSymbol('access/transam.h', \@include_path,'FirstBootstrapObjectId');
60+
my$INTERNALlanguageId =
61+
Catalog::FindDefinedSymbol('catalog/pg_language.h', \@include_path,'INTERNALlanguageId');
5962

6063
# Read all the data from the include/catalog files.
6164
my$catalogs = Catalog::Catalogs($infile);
@@ -77,8 +80,7 @@
7780
@bki_values{@attnames} = Catalog::SplitDataLine($row->{bki_values});
7881

7982
# Select out just the rows for internal-language procedures.
80-
# Note assumption here that INTERNALlanguageId is 12.
81-
nextif$bki_values{prolang}ne'12';
83+
nextif$bki_values{prolang}ne$INTERNALlanguageId;
8284

8385
push@fmgr,
8486
{oid=>$row->{oid},
@@ -281,7 +283,8 @@ sub usage
281283
die<<EOM;
282284
Usage: perl -I [directory of Catalog.pm] Gen_fmgrtab.pl [path to pg_proc.h]
283285
284-
Gen_fmgrtab.pl generates fmgroids.h and fmgrtab.c from pg_proc.h
286+
Gen_fmgrtab.pl generates fmgroids.h, fmgrprotos.h, and fmgrtab.c from
287+
pg_proc.h
285288
286289
Report bugs to <pgsql-bugs\@postgresql.org>.
287290
EOM

‎src/include/catalog/pg_partitioned_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* src/include/catalog/pg_partitioned_table.h
1111
*
1212
* NOTES
13-
* the genbki.sh script reads this file and generates .bki
13+
* the genbki.pl script reads this file and generates .bki
1414
* information from the DATA() statements.
1515
*
1616
*-------------------------------------------------------------------------

‎src/include/catalog/pg_sequence.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/* -------------------------------------------------------------------------
2+
*
3+
* pg_sequence.h
4+
* definition of the system "sequence" relation (pg_sequence)
5+
*
6+
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7+
* Portions Copyright (c) 1994, Regents of the University of California
8+
*
9+
* -------------------------------------------------------------------------
10+
*/
111
#ifndefPG_SEQUENCE_H
212
#definePG_SEQUENCE_H
313

‎src/include/catalog/pg_statistic.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,10 @@ typedef FormData_pg_statistic *Form_pg_statistic;
161161
#defineAnum_pg_statistic_stavalues526
162162

163163
/*
164-
* Currently, five statistical slot "kinds" are defined by core PostgreSQL,
165-
* as documented below. Additional "kinds" will probably appear in
166-
* future to help cope with non-scalar datatypes. Also, custom data types
167-
* can define their own "kind" codes by mutual agreement between a custom
168-
* typanalyze routine and the selectivity estimation functions of the type's
169-
* operators.
164+
* Several statistical slot "kinds" are defined by core PostgreSQL, as
165+
* documented below. Also, custom data types can define their own "kind"
166+
* codes by mutual agreement between a custom typanalyze routine and the
167+
* selectivity estimation functions of the type's operators.
170168
*
171169
* Code reading the pg_statistic relation should not assume that a particular
172170
* data "kind" will appear in any particular slot. Instead, search the

‎src/include/catalog/pg_subscription_rel.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@
2323
*/
2424
#defineSubscriptionRelRelationId6102
2525

26-
/* Workaround for genbki not knowing about XLogRecPtr */
27-
#definepg_lsn XLogRecPtr
28-
2926
CATALOG(pg_subscription_rel,6102)BKI_WITHOUT_OIDS
3027
{
3128
Oidsrsubid;/* Oid of subscription */
3229
Oidsrrelid;/* Oid of relation */
3330
charsrsubstate;/* state of the relation in subscription */
34-
pg_lsnsrsublsn;/* remote lsn of the state change used for
31+
XLogRecPtrsrsublsn;/* remote lsn of the state change used for
3532
* synchronization coordination */
3633
}FormData_pg_subscription_rel;
3734

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp