Re: unknownin/out patch (was [HACKERS] PQescapeBytea is

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: mail(at)joeconway(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org, lockhart(at)fourpalms(dot)org
Subject: Re: unknownin/out patch (was [HACKERS] PQescapeBytea is
Date: 2002-04-09 05:08:56
Message-ID: 20020409140856E.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> > Tatsuo Ishii wrote:
> > >
> > >
> > > Try a multibyte encoding database. For example,
> > >
> > > $ createdb -E EUC_JP test
> > > $ psql -c 'SELECT SUBSTRING('1234567890' FROM 3)' test
> > > substring
> > > -----------
> > > 3456
> > > (1 row)
> > >
> > > Apparently this is wrong.
> > > --
> > > Tatsuo Ishii
> >
> > This problem exists in CVS tip *without* the unknownin/out patch:
>
> Sure. That has been broken for a while.

I guess this actually happened in 1.79 of varlena.c:

---------------------------------------------------------------------------
revision 1.79
date: 2002/03/05 05:33:19; author: momjian; state: Exp; lines: +45 -42
I attach a version of my toast-slicing patch, against current CVS
(current as of a few hours ago.)

This patch:

1. Adds PG_GETARG_xxx_P_SLICE() macros and associated support routines.

2. Adds routines in src/backend/access/tuptoaster.c for fetching only
necessary chunks of a toasted value. (Modelled on latest changes to
assume chunks are returned in order).

3. Amends text_substr and bytea_substr to use new methods. It now
handles multibyte cases -and should still lead to a performance
improvement in the multibyte case where the substring is near the
beginning of the string.

4. Added new command: ALTER TABLE tabname ALTER COLUMN colname SET
STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN} to parser and documented in
alter-table.sgml. (NB I used ColId as the item type for the storage
mode string, rather than a new production - I hope this makes sense!).
All this does is sets attstorage for the specified column.

4. AlterTableAlterColumnStatistics is now AlterTableAlterColumnFlags and
handles both statistics and storage (it uses the subtype code to
distinguish). The previous version of my patch also re-arranged other
code in backend/commands/command.c but I have dropped that from this
patch.(I plan to return to it separately).

5. Documented new macros (and also the PG_GETARG_xxx_P_COPY macros) in
xfunc.sgml. ref/alter_table.sgml also contains documentation for ALTER
COLUMN SET STORAGE.

John Gray
---------------------------------------------------------------------------

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-04-09 05:37:59 Re: unknownin/out patch (was [HACKERS] PQescapeBytea is
Previous Message Bruce Momjian 2002-04-09 04:44:15 Re: Strange problem when upgrading to 7.2 with pg_upgrade.

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-04-09 05:37:59 Re: unknownin/out patch (was [HACKERS] PQescapeBytea is
Previous Message Tatsuo Ishii 2002-04-09 01:23:42 Re: unknownin/out patch (was [HACKERS] PQescapeBytea is