Thread: psql \i

psql \i

From
Richard Harvey Chapman
Date:
I have a text file of SQL commands which contains tabs.  I used to be able
to import it using psql using "\i file.sql".  Now, I've upgraded to 7.0.2
and it treats the file as if I'm entering it all in manually.  It treats
the tabs as completion commands.

CREATE TABLE alpha (
<TAB>num<TAB>SERIAL PRIMARY KEY
);

will return a syntax error at PRIMARY because it sees the following:

CREATE TABLE alpha (
numSERIAL PRIMARY KEY
);

Is there something new that I have to do?

(besides converting the tabs -- if all else fails, I'll do that)

R.



Re: psql \i --UPDATE

From
Richard Harvey Chapman
Date:
This turned out to be a problem that I discovered before with psql's
parser not correctly handling single quotation marks within C style
comments.  I have my file under source control with the revision
information nested inside some C style comments, but one of the revision
change messages had a single quote in it.

BTW single quotes behind "--" work fine.

R.


On Wed, 12 Jul 2000, Richard Harvey Chapman wrote:

> I have a text file of SQL commands which contains tabs.  I used to be able
> to import it using psql using "\i file.sql".  Now, I've upgraded to 7.0.2
> and it treats the file as if I'm entering it all in manually.  It treats
> the tabs as completion commands.
>
> CREATE TABLE alpha (
> <TAB>num<TAB>SERIAL PRIMARY KEY
> );
>
> will return a syntax error at PRIMARY because it sees the following:
>
> CREATE TABLE alpha (
> numSERIAL PRIMARY KEY
> );
>
> Is there something new that I have to do?
>
> (besides converting the tabs -- if all else fails, I'll do that)
>
> R.
>
>