Re: initdb failure (was Re: [GENERAL] sequence's plpgsql) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Date
Msg-id 200309261831.h8QIVWV23087@candle.pha.pa.us
Whole thread Raw
In response to Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut wrote:
> Tom Lane writes:
>
> > so it appears that cygwin's "echo" generates a different newline style
> > than what got put into sql_features.txt.  A possible way to fix this is
> > to put the "\." line into sql_features.txt, but maybe there's a cleaner
> > answer.  Peter, any thoughts?
>
> There's no clean answer to this on Cygwin.  This specific case is just a
> little problem that we could solve locally, but in general you'll just end
> up annoying people if you require them to use consistent line endings on
> Cygwin.

Here is a little diff to make initdb behave if we decide to keep the
COPY check.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/initdb/initdb.sh
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/initdb/initdb.sh,v
retrieving revision 1.201
diff -c -c -r1.201 initdb.sh
*** src/bin/initdb/initdb.sh    7 Sep 2003 03:36:03 -0000    1.201
--- src/bin/initdb/initdb.sh    26 Sep 2003 18:23:16 -0000
***************
*** 1087,1094 ****
    echo "COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name,
is_supported,comments) FROM STDIN;" 
    cat "$datadir"/sql_features.txt
    echo "\."
! ) \
!     | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
  echo "ok"

  $ECHO_N "vacuuming database template1... "$ECHO_C
--- 1087,1095 ----
    echo "COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name,
is_supported,comments) FROM STDIN;" 
    cat "$datadir"/sql_features.txt
    echo "\."
! ) |
! tr -d '\r' | # make newlines consistent for Win32
! "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
  echo "ok"

  $ECHO_N "vacuuming database template1... "$ECHO_C

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Next
From: "Marc G. Fournier"
Date:
Subject: Re: 2-phase commit