Re: Should we automatically run duplicate_oids?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should we automatically run duplicate_oids?
Date: 2013-07-09 14:40:13
Message-ID: 51DC20CD.3000606@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 07/08/2013 11:03 PM, Peter Geoghegan wrote:
> On Mon, Jul 8, 2013 at 7:59 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>> I don't think rewriting it in Perl is necessary or even desirable. I
>> don't see anything particularly unportable in that script as it is.
> I was under the impression that the final patch ought to work on
> Windows too. However, I suppose that since the number of people that
> use windows as an everyday development machine is probably zero, we
> could reasonably forgo doing anything on that platform.
>
>

Why the heck should we? To my certain knowledge there are people using
Windows as a development platform for PostgreSQL code, albeit not core
code. If we ever want to get them involved in writing core code we need
to treat them as first class citizens.

This is actually a pretty trivial task. Here is a simple perl version:

use strict;

my @files = (qw( toasting.h indexing.h), glob("pg_*.h"));

my $handle;
my @lines;
foreach my $file (@files)
{
my $handle;
open($handle,$file) || die "$!";
my @flines = <$handle>;
close($handle);
chomp @flines;
push(@lines, @flines);
}

my %oidcounts;

foreach (@lines)
{
next if /^CATALOG\(.*BKI_BOOTSTRAP/;
next unless
/^DATA\(insert *OID *= *([0-9][0-9]*).*$/ ||
/^CATALOG\([^,]*,
*([0-9][0-9]*).*BKI_ROWTYPE_OID\(([0-9][0-9]*)\).*$/ ||
/^CATALOG\([^,]*, *([0-9][0-9]*).*$/ ||
/^DECLARE_INDEX\([^,]*, *([0-9][0-9]*).*$/ ||
/^DECLARE_UNIQUE_INDEX\([^,]*, *([0-9][0-9]*).*$/ ||
/^DECLARE_TOAST\([^,]*, *([0-9][0-9]*), *([0-9][0-9]*).*$/;
$oidcounts{$1}++;
$oidcounts{$2}++ if $2;
}

my $found = 0;

foreach my $oid (sort {$a <=> $b} keys %oidcounts)
{
next unless $oidcounts{$oid} > 1;
$found = 1;
print "$oid\n";
}

exit $found;

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-07-09 14:43:19 Re: Millisecond-precision connect_timeout for libpq
Previous Message ivan babrou 2013-07-09 14:27:09 Re: Millisecond-precision connect_timeout for libpq