Re: commenting sql code

From: joseph speigle <joe(dot)speigle(at)jklh(dot)us>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: commenting sql code
Date: 2004-02-20 15:00:25
Message-ID: 20040220150025.GA19785@www.sirfsup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

hello tom and bruno,

Thanks for solving this issue for me. Doing as you say \i and not \e correctly ignores comments. All I wanted to do BTW was what it looks like: edit an sql file from the cwd in the buffer and run it as a script when I close the buffer (I want to say vi buffer and "quit vi with :wq"). I hadn't tried loading the file with \i. I also notice now that it runs correctly doing psql -d test < file_name.sql and correctly ignores the comments, but before I wasn't sure if postgres had special comment syntax!!

On Fri, Feb 20, 2004 at 09:42:55AM -0500, Tom Lane wrote:
> Bruno LEVEQUE <bruno(dot)leveque(at)net6d(dot)com> writes:
> > In your example you must use \i and not \e
>
> On investigation, this is actually a bug in the way \e works --- when
> the file is read back into psql, it's effectively treated as a single
> line, and so the comment kills more than you'd expect. I am amused to
> realize that the bug is fixed in CVS tip, as a completely unintended
> consequence of the flex rewrite I just did ...
>
> But I agree that \i not \e is the preferred way to invoke a SQL file
> that already exists. I am not sure if that's what Joe was trying to
> do or not.
>
> regards, tom lane
joe
--
speigle
www.sirfsup.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message beyaNet Consultancy 2004-02-20 15:22:50 Binary retrieval - *Best practice* recommendations...
Previous Message Tom Lane 2004-02-20 14:42:55 Re: commenting sql code