Re: [HACKERS] WITH DELIMITERS in COPY

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] WITH DELIMITERS in COPY
Date: 2002-04-23 16:19:21
Message-ID: 200204231619.g3NGJL410624@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I see in user.c::CreateUser:

if (strcmp(defel->defname, "password") == 0 ||
strcmp(defel->defname, "encryptedPassword") == 0 ||
strcmp(defel->defname, "unencryptedPassword") == 0)
{
if (dpassword)
elog(ERROR, "CREATE USER: conflicting options");
dpassword = defel;
if (strcmp(defel->defname, "encryptedPassword") == 0)
encrypt_password = true;
else if (strcmp(defel->defname, "unencryptedPassword") == 0)
encrypt_password = false;
}
else if (strcmp(defel->defname, "sysid") == 0)
{
if (dsysid)
elog(ERROR, "CREATE USER: conflicting options");
dsysid = defel;
}

Looks like this is how we normally test for conflicting params. Does
this help?

---------------------------------------------------------------------------

Gavin Sherry wrote:
> Bruce,
>
> Attached is a modified patch, using DefElem instead of the 'roll your own'
> method of collecting optional parameters to CopyStmt.
>
> Naturally, DoCopy() as well as a few support functions needed to be
> modified to get this going.
>
> In order to check if parameters were being passed more than once (COPY
> ... WITH OIDS FROM ... WITH DELIMITER '\t' OIDS), I have added a function
> defelemmember() to list.c. I could not think, off the top of my head, of a
> more elegant way to do this.
>
> Gavin
>
>
> On Sun, 14 Apr 2002, Bruce Momjian wrote:
>
> >
> > Gavin, I will do the legwork on this if you wish. I think we need to
> > use DefElem to store the COPY params, rather than using specific fields
> > in CopyStmt.
> >
> > Would you send me your original patch so I am make sure I hit
> > everything. I can't seem to find a copy. If you would like to work on
> > it, I can give you what I have and walk you through the process.
> >
> > ---------------------------------------------------------------------------
> >
> > Gavin Sherry wrote:
> > > Hi Bruce,
> > >
> > > On Tue, 5 Mar 2002, Bruce Momjian wrote:
> > >
> > > >
> > > > Seems the original title about "feature causes performance in COPY" was
> > > > confusing.
> > >
> > > Oops.
> > >
> > > > This patch merely fixes the identified TODO item in the
> > > > grammar about using WITH in COPY.
> > >
> > > Now that I look at this patch again I don't think I like the
> > > syntax.
> > >
> > > COPY [BINARY] <relation> [WITH OIDS] TO | FROM <file> [[USING DELIMITERS |
> > > WITH DELIMITER] <delimiter> [WITH NULL AS <char>]
> > >
> > > It isn't very elegant.
> > >
> > > 1) I forced the parser to be able to handle multiple WITHs, but that
> > > doesn't mean its right. I can't remember why I didn't propose a better
> > > syntax back then, such as:
> > >
> > > ... [WITH [DELIMITER <delimiter>,] [NULL AS <char>]]
> > >
> > > 2) Given (1), Why does WITH OIDS belong where it is now? Why not have it
> > > as an 'option' at the end?
> > >
> > > Anyone have any opinion on this?
> > >
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> > >
> >
> >

Content-Description:

[ Attachment, skipping... ]

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-04-23 16:27:31 Vote on SET in aborted transaction
Previous Message Tom Lane 2002-04-23 16:02:04 Re: "make report"

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-04-23 16:51:38 Re: [HACKERS] build of 7.2.1 on SCO Openserver and Unixware
Previous Message Barry Lind 2002-04-23 16:03:32 Re: [PATCHES] patch for ResultSet.java