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 16:15:58
Message-ID: 51DC373E.2040109@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 07/09/2013 10:40 AM, Andrew Dunstan wrote:
>
> 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:

Slightly cleaner (and shorter) version:

use strict;

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

@ARGV = @files;
}

my %oidcounts;

while(<>)
{
next if /^CATALOG\(.*BKI_BOOTSTRAP/;
next unless
/^DATA\(insert *OID *= *(\d+)/ ||
/^CATALOG\([^,]*, *(\d+).*BKI_ROWTYPE_OID\((\d+)\)/ ||
/^CATALOG\([^,]*, *(\d+)/ ||
/^DECLARE_INDEX\([^,]*, *(\d+)/ ||
/^DECLARE_UNIQUE_INDEX\([^,]*, *(\d+)/ ||
/^DECLARE_TOAST\([^,]*, *(\d+), *(\d+)/;
$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

Browse pgsql-hackers by date

  From Date Subject
Next Message Robins Tharakan 2013-07-09 16:39:34 Re: Patch to add regression tests for SCHEMA
Previous Message Fabien COELHO 2013-07-09 15:57:01 Re: Patch to add regression tests for SCHEMA