Re: Should we automatically run duplicate_oids? - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Should we automatically run duplicate_oids?
Date
Msg-id 51DC373E.2040109@dunslane.net
Whole thread Raw
In response to Re: Should we automatically run duplicate_oids?  (Andrew Dunstan <andrew@dunslane.net>)
List 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@gmx.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




pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Patch to add regression tests for SCHEMA
Next
From: ivan babrou
Date:
Subject: Re: Millisecond-precision connect_timeout for libpq