Re: Should we automatically run duplicate_oids?

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Should we automatically run duplicate_oids?
Дата
Msg-id 51DC20CD.3000606@dunslane.net
обсуждение исходный текст
Ответ на Re: Should we automatically run duplicate_oids?  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: Should we automatically run duplicate_oids?  (Andrew Dunstan <andrew@dunslane.net>)
Re: Should we automatically run duplicate_oids?  (Peter Eisentraut <peter_e@gmx.net>)
Список 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 по дате отправления:

Предыдущее
От: Markus Wanner
Дата:
Сообщение: Re: Millisecond-precision connect_timeout for libpq
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Millisecond-precision connect_timeout for libpq