Re: Patch to bring \copy syntax more in line with SQL copy

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to bring \copy syntax more in line with SQL copy
Date: 2004-01-21 01:16:55
Message-ID: 400DD307.9060703@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway wrote:
> A few quick comments:
>
> - don't use C++-style comments

Oops ... sorry ... been doing too much PHP.

BTW: Why is this frowned apon so? Are there compilers that have
problems with it? In my own code, I generally use // and /* */
interchangeably, and I've never had any problems (with C). Yet,
this isn't the first time I've submitted a patch and had it
pointed out that I shouldn't use C++ comments in C.

> - please update the documentation

I'm not aware that the documentation needs updated. I changed the
code to be up to date with the docs I found. If there's docs that
need updated, please point me specifically to them and I'll be
happy to generate a patch to the best of my ability.

> - update the comment at the top of copy.c

Oops ... got it.

> Bill Moran <wmoran(at)potentialtech(dot)com> writes:
>
>>Ideally, this should cover all cases of old and new syntax, except
>>where "AS" is present.
>
> ISTM it would be easy to allow for an optional 'AS' token following
> the 'DELIMITER[S]' token.

Well ... keep in mind that I'm not as familiar with the code as you ...
this is my first hack into PostgreSQL, and I'm not terribly familiar
with the code yet.

Now that I'm looking over the code for strtokx(), I'm seeing that
you're absolutely right, it won't take much to accept the optional
AS.

>>The only drawback I can see is that \copy is now more liberal in
>>what it accepts, and may accept incomplete statements without
>>issuing an error (i.e. a WITH or USING clause at the end of a \copy
>>statement will simply be ignored, and no error generated)
>
> Why can't you check for this?

I suppose I can. It's just that the code falls together so simply
without the check, and I can't see anyway to keep it that simple while
still checking ... but I suppose it'd be better to have it fail
properly than to save a few lines of code.

Thanks for the quick feedback. I hope you didn't see that post to
hackers and take it as me bitching and whining or anything, it's just
that I'm not 100% familiar with how things flow within the PostgreSQL
group, and I was curious.

A revised patch will be forthcoming, as soon as I find some time ...
a day or two probably, over the weekend as worst case scenerio.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2004-01-21 03:49:11 Re: Patch to bring \copy syntax more in line with SQL
Previous Message Tom Lane 2004-01-20 23:50:03 Re: Current-stream read for psql's \copy