Re: Re: Toast,bytea, Text -blob all confusing
| От | Hannu Krosing |
|---|---|
| Тема | Re: Re: Toast,bytea, Text -blob all confusing |
| Дата | |
| Msg-id | 3B8E4E72.1566105A@tm.ee обсуждение исходный текст |
| Ответ на | RE: Re: Toast,bytea, Text -blob all confusing ("Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>) |
| Список | pgsql-hackers |
Zeugswetter Andreas SB SD wrote:
>
> > > > >For bytea, follow this rule: to escape a null character, use
> this:
> > > > >'\\0'. To escape a backslash, use this: '\\\\'.
>
> Can anybody explain in technical terms why this is implemented
> so inconveniently ?
I think that this has to to with making textin and textout behave
symmetrically, and the requirement that textout must produce a
valid C-string for ASCII transfer format.
> Since bytea is probably not very common among users yet
> we could imho still change it to not do double escapes.
But how ?
> Imho we need to decide where to do the escaping,
> eighter in the parser or in the input functions.
It would be probably hard to make the parser to _not_ unescape some
types, as it does not yet know it
> I think actually the backend parser has no business changing
> constants, he is imho only allowed to parse it, so he knows
> where a constant begins, and where it ends.
If it is any consolation then you have to write the inset of
a single \ from shell command so:
> psql -c "insert into t values('\\\\\\\\')"
;)
------------------
Hannu
В списке pgsql-hackers по дате отправления: