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 51DC20CD.3000606@dunslane.net
Whole thread Raw
In response to Re: Should we automatically run duplicate_oids?  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Should we automatically run duplicate_oids?
Re: Should we automatically run duplicate_oids?
List 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@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:


   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



pgsql-hackers by date:

Previous
From: Markus Wanner
Date:
Subject: Re: Millisecond-precision connect_timeout for libpq
Next
From: Andres Freund
Date:
Subject: Re: Millisecond-precision connect_timeout for libpq