|
2 | 2 | #----------------------------------------------------------------------
|
3 | 3 | #
|
4 | 4 | # genbki.pl
|
5 |
| -# Perl script that generates postgres.bki, postgres.description, |
6 |
| -# postgres.shdescription, and symbol definition headers from specially |
7 |
| -# formatted header files and data files. The BKI files are used to |
8 |
| -# initialize the postgres template database. |
| 5 | +# Perl script that generates postgres.bki and symbol definition |
| 6 | +# headers from specially formatted header files and data files. |
| 7 | +# postgres.bki is used to initialize the postgres template database. |
9 | 8 | #
|
10 | 9 | # Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
11 | 10 | # Portions Copyright (c) 1994, Regents of the University of California
|
|
93 | 92 | my $data = Catalog::ParseData($datfile, $schema, 0);
|
94 | 93 | $catalog_data{$catname} = $data;
|
95 | 94 |
|
96 |
| - # Check for duplicated OIDs while we're at it. |
97 | 95 | foreach my $row (@$data)
|
98 | 96 | {
|
| 97 | + # Generate entries for pg_description and pg_shdescription. |
| 98 | + if (defined $row->{descr}) |
| 99 | + { |
| 100 | + my %descr = ( |
| 101 | + objoid => $row->{oid}, |
| 102 | + classoid => $catalog->{relation_oid}, |
| 103 | + objsubid => 0, |
| 104 | + description => $row->{descr}); |
| 105 | + |
| 106 | + if ($catalog->{shared_relation}) |
| 107 | + { |
| 108 | + delete $descr{objsubid}; |
| 109 | + push @{ $catalog_data{pg_shdescription} }, \%descr; |
| 110 | + } |
| 111 | + else |
| 112 | + { |
| 113 | + push @{ $catalog_data{pg_description}}, \%descr; |
| 114 | + } |
| 115 | + } |
| 116 | + |
| 117 | + # Check for duplicated OIDs while we're at it. |
99 | 118 | $oidcounts{ $row->{oid} }++ if defined $row->{oid};
|
100 | 119 | }
|
101 | 120 | }
|
|
361 | 380 | my $schemafile = $output_path . 'schemapg.h';
|
362 | 381 | open my $schemapg, '>', $schemafile . $tmpext
|
363 | 382 | or die "can't open $schemafile$tmpext: $!";
|
364 |
| -my $descrfile = $output_path . 'postgres.description'; |
365 |
| -open my $descr, '>', $descrfile . $tmpext |
366 |
| - or die "can't open $descrfile$tmpext: $!"; |
367 |
| -my $shdescrfile = $output_path . 'postgres.shdescription'; |
368 |
| -open my $shdescr, '>', $shdescrfile . $tmpext |
369 |
| - or die "can't open $shdescrfile$tmpext: $!"; |
370 | 383 |
|
371 |
| -# Generate postgres.bki, postgres.description, postgres.shdescription, |
372 |
| -# and pg_*_d.h headers. |
| 384 | +# Generate postgres.bki and pg_*_d.h headers. |
373 | 385 |
|
374 | 386 | # version marker for .bki file
|
375 | 387 | print $bki "# PostgreSQL $major_version\n";
|
|
579 | 591 | # Write to postgres.bki
|
580 | 592 | print_bki_insert(\%bki_values, $schema);
|
581 | 593 |
|
582 |
| - # Write comments to postgres.description and |
583 |
| - # postgres.shdescription |
584 |
| - if (defined $bki_values{descr}) |
585 |
| - { |
586 |
| - if ($catalog->{shared_relation}) |
587 |
| - { |
588 |
| - printf $shdescr "%s\t%s\t%s\n", |
589 |
| - $bki_values{oid}, $catname, $bki_values{descr}; |
590 |
| - } |
591 |
| - else |
592 |
| - { |
593 |
| - printf $descr "%s\t%s\t0\t%s\n", |
594 |
| - $bki_values{oid}, $catname, $bki_values{descr}; |
595 |
| - } |
596 |
| - } |
597 |
| - |
598 | 594 | # Emit OID symbol
|
599 | 595 | if (defined $bki_values{oid_symbol})
|
600 | 596 | {
|
|
673 | 669 | # We're done emitting data
|
674 | 670 | close $bki;
|
675 | 671 | close $schemapg;
|
676 |
| -close $descr; |
677 |
| -close $shdescr; |
678 | 672 |
|
679 | 673 | # Finally, rename the completed files into place.
|
680 | 674 | Catalog::RenameTempFile($bkifile, $tmpext);
|
681 | 675 | Catalog::RenameTempFile($schemafile, $tmpext);
|
682 |
| -Catalog::RenameTempFile($descrfile, $tmpext); |
683 |
| -Catalog::RenameTempFile($shdescrfile, $tmpext); |
684 | 676 |
|
685 | 677 | exit 0;
|
686 | 678 |
|
@@ -967,9 +959,9 @@ sub usage
|
967 | 959 | --set-version PostgreSQL version number for initdb cross-check
|
968 | 960 | --include-path Include path in source tree
|
969 | 961 |
|
970 |
| -genbki.pl generates BKI files and symbol definition |
| 962 | +genbki.pl generates postgres.bki and symbol definition |
971 | 963 | headers from specially formatted header files and .dat
|
972 |
| -files. The BKI files are used to initialize the |
| 964 | +files. postgres.bki is used to initialize the |
973 | 965 | postgres template database.
|
974 | 966 |
|
975 | 967 | Report bugs to <pgsql-bugs\@lists.postgresql.org>.
|
|
0 commit comments