LinuxPPC/PG 7.0.2 .ctl file handling and \i comment parsing

From: Simon Banton <simon(at)web(dot)org(dot)uk>
To: pgsql-bugs(at)postgresql(dot)org
Subject: LinuxPPC/PG 7.0.2 .ctl file handling and \i comment parsing
Date: 2000-08-02 12:45:05
Message-ID: p04320400b5adc7742d81@[194.153.3.60]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Simon Banton
Your email address : simon(at)web(dot)org(dot)uk

System Configuration
---------------------
Architecture (example: Intel Pentium): PowerMac G3

Operating System (example: Linux 2.0.26 ELF): 2.2.6-15apmac (LinuxPPC 1999)

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.2

Compiler used (example: gcc 2.8.0): egcs-2.91.66 19990314
(egcs-1.1.2 release)

Please enter a FULL description of your problem:
------------------------------------------------

1) During installation of OpenACS (www.openacs.org), it is necessary to run a
shell script that executes a number of .ctl files:

#! /bin/sh

psql -f acs_geo_parents.sql $*

for f in *.ctl; do
echo loading $f...
psql -f $f $*
done

The format of the ctl files is as in the following example extract:

COPY BBOARD_EPA_REGIONS FROM stdin USING DELIMITERS '|';
Alabama|01|4|AL|Southeast Region
Alaska|02|10|AK|Northwestern Region
American Samoa|60|9|AS|Western Region
... etc

The script hangs waiting for input from stdin, instead of reading the data
from the file itself.

2) Later in the installation process, a sql script is required to be run:

psql -f load-data-model.sql [your database name]

This file contains a number of \i directives, those with comments on the same
line as the filename to be included... eg:

\i general-permissions.sql -- much bigger for ACS 3.2.0

... fail with an error similar to (don't have exact wording to hand):

'failed to find "general-permissions.sql -- much bigger for ACS 3.2.0"'

... ie it appears that the psql parser is reading the entire line after \i as
the required filename, and doesn't spot the -- comment delimiter.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Repeatable on this platform using the shell script and command line detailed
above, in an OpenACS installation.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Separating the .ctl files into 2 components such that the data is placed in a
separate file, and the ctl file adjusted accordingly... eg:

COPY BBOARD_EPA_REGIONS FROM '/tmp/dat/bboard_epa_regions.dat' USING
DELIMITERS '|';

fixes problem 1) to the extent that the shell script completes successfully.

Deleting the appended comments from the \i lines in the sql script fixes
problem 2) eg:

\i general-permissions.sql

I am advised by OpenACS project that these issues appear to be
architecture-specific, and they asked I report the problems here.

S.

Browse pgsql-bugs by date

  From Date Subject
Next Message Gena Gurchonok 2000-08-03 10:26:39 ALTER TABLE
Previous Message Tom Lane 2000-07-28 16:26:48 Re: postgresql-7.0.2: install-sh cannot install pgaccess