Re: Enums patch v2

Поиск
Список
Период
Сортировка
От Tom Dunstan
Тема Re: Enums patch v2
Дата
Msg-id 45D251E3.7040908@tomd.cc
обсуждение исходный текст
Ответ на Re: Enums patch v2  (Neil Conway <neilc@samurai.com>)
Ответы Re: Enums patch v2  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-patches
Neil Conway wrote:
> On Thu, 2007-02-01 at 22:50 -0500, Bruce Momjian wrote:
>> Where are we on this?
>
> I can commit to reviewing this. The patch looked fairly solid on a quick
> glance through, but I won't have the cycles to review it properly for a
> week or two.

I've brought this up to date with the operator family stuff now, and the
attached patch once more applies cleanly against HEAD. Hopefully that'll
make life a little easier when reviewing it. Thanks.

I got sick of manually shifting the new OID values every time someone
had added something new to the catalogs, so I moved all of my OIDs up to
the 9000 range. Attached is a hacky bash script which can move them back
to something sane. The idea is to run unused_oids first, see where the
main block of unused OIDs starts, and then run shift_oids on the
(unzipped) patch file before applying the patch. We discussed something
similar a while ago, but no-one ever got around to implementing the script.

I've attached the script and left the OIDs in my patch in the upper
range rather than just running it myself before submitting the patch as
I reckon that this might be a useful convention for authors of patches
which add a non-trivial number of OIDs to the catalogs. If there's
agreement then anyone can feel free to commit the script to CVS or put
it on the wiki or whatever.

Cheers

Tom
#!/bin/sh

start=$1
end=$2
new_start=$3
filename=$4

if [ -z "$filename" ] ; then
    echo Usage: $0 start-oid end-oid new-start-oid filename
    exit 1
fi

if [ ! -f $filename ] ; then
    echo $0: $filename is not a file
    exit 1
fi

if [ $end -le $start ] ; then
    echo $0: End of OID range must be greater than or equal to the start
    exit 1
fi

start_len=`echo -n $start | wc -c`
end_len=`echo -n $end | wc -c`

if [ $start_len -ne 4 -o $end_len -ne 4 ] ; then
    echo $0: Source OID range must have 4 digits
    exit 1
fi

let new_end=$new_start+$end-$start
if [ $start -le $new_start -a $end -ge $new_start -o $new_start -le $start -a $new_end -ge $start ] ; then
    echo $0: OID ranges may not overlap
    exit 1
fi


i=$start
j=$new_start
while [ $i -le $end ] ; do
    #echo $i $j
    sed -i "s/$i/$j/g" $filename
    let i=i+1
    let j=j+1
done

Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Forbid finishing a prepared transaction from another database
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Forbid finishing a prepared transaction from another database