Re: Bytea string operator support

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <joseph(dot)conway(at)home(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Bytea string operator support
Date: 2001-09-13 16:57:43
Message-ID: 200109131657.f8DGvhT26227@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Have we made a decision on this? I think we should apply it.

> > >
> > > > 2. Added PQescapeBytea to fe-exec.c
> > >
> > > I'm not sure if we want to encode the peculiarities of particular data
> > > types into the client libraries. I could agree with adding a function
> > > that supplies a general-purpose encoding such as base64 (not necessarily
> > > preferred) which clients can use to feed data to the server. In the
> > > future we might want to support the SQL-standard input formats for
> binary
> > > data types, which would require yet another round of functions to be
> added
> > > to libpq.
> > >
> > > After all, bytea is utterly non-standard, and if we make API extensions
> we
> > > should consider them in the long run.
> >
> > Bytea is pecular because you can't have the escaping done in the backend
> > because of the binary nature of bytea. I think there was an attempt to
> > merge this into the escaping of SQL queries but that can't work because
> > of the handling of nulls and the string possibly being four times bigger
> > than the original.
> >
> > I agree this is type pollution into libpq but I don't see another option
> > except having the user code this stuff into their application. Maybe we
> > need some type-handling library in the future were we can put all this
> > stuff. Maybe we can add this to libpq now and create a separate library
> > when we need one.
> >
> > Comments?
>
> That was the main reason I wanted to see the bytea escape function in the
> PostgreSQL client library. Without it, every user needs to code something
> that performs this same functionality into their own app if they want to do
> something like: insert into foo(f1) values ('binary stuff');
>
> Someone has mentioned that the Perl DBI module for PostgreSQL can
> already do this, but that doesn't help anyone writing in C or PHP
> (as two examples).
>
> Certainly if there is a SQL-standard, it would be better to support it. I
> scanned through SQL99, but didn't spot anything on SQL-standard input
> formats for binary. Peter, can you point me in the right direction?
>
> -- Joe
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
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

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2001-09-13 17:16:54 Re: Bytea string operator support
Previous Message John Summerfield 2001-09-13 09:42:38 SQLCODE==-209