mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
The following small patch provides a couple of minor updates (against
CVS HEAD): Amended "strings" regression test. TOAST tests now insert two values with storage set to "external", to exercise properly the TOAST slice routines which fetch only a subset of the chunks. Changed now-misleading comment on AlterTableCreateToastTable in tablecmds.c, because both columns of the index on a toast table are now used. John Gray
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.34 2002/08/27 03:56:34 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.35 2002/08/28 20:18:29 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@@ -3417,12 +3417,13 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
|
|||||||
/*
|
/*
|
||||||
* Create unique index on chunk_id, chunk_seq.
|
* Create unique index on chunk_id, chunk_seq.
|
||||||
*
|
*
|
||||||
* NOTE: the tuple toaster could actually function with a single-column
|
* NOTE: the normal TOAST access routines could actually function with
|
||||||
* index on chunk_id only. However, it couldn't be unique then. We
|
* a single-column index on chunk_id only. However, the slice access
|
||||||
* want it to be unique as a check against the possibility of
|
* routines use both columns for faster access to an individual chunk.
|
||||||
* duplicate TOAST chunk OIDs. Too, the index might be a little more
|
* In addition, we want it to be unique as a check against the
|
||||||
* efficient this way, since btree isn't all that happy with large
|
* possibility of duplicate TOAST chunk OIDs. The index might also be
|
||||||
* numbers of equal keys.
|
* a little more efficient this way, since btree isn't all that happy
|
||||||
|
* with large numbers of equal keys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
indexInfo = makeNode(IndexInfo);
|
indexInfo = makeNode(IndexInfo);
|
||||||
|
@@ -579,6 +579,13 @@ SELECT text 'text' || varchar ' and varchar' AS "Concat text to varchar";
|
|||||||
CREATE TABLE toasttest(f1 text);
|
CREATE TABLE toasttest(f1 text);
|
||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
--
|
||||||
|
-- Ensure that some values are uncompressed, to test the faster substring
|
||||||
|
-- operation used in that case
|
||||||
|
--
|
||||||
|
alter table toasttest alter column f1 set storage external;
|
||||||
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
@@ -586,7 +593,9 @@ SELECT substr(f1, -1, 5) from toasttest;
|
|||||||
--------
|
--------
|
||||||
123
|
123
|
||||||
123
|
123
|
||||||
(2 rows)
|
123
|
||||||
|
123
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
-- If the length is less than zero, an ERROR is thrown.
|
-- If the length is less than zero, an ERROR is thrown.
|
||||||
SELECT substr(f1, 5, -1) from toasttest;
|
SELECT substr(f1, 5, -1) from toasttest;
|
||||||
@@ -598,7 +607,9 @@ SELECT substr(f1, 99995) from toasttest;
|
|||||||
--------
|
--------
|
||||||
567890
|
567890
|
||||||
567890
|
567890
|
||||||
(2 rows)
|
567890
|
||||||
|
567890
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
-- If start plus length is > string length, the result is truncated to
|
-- If start plus length is > string length, the result is truncated to
|
||||||
-- string length
|
-- string length
|
||||||
@@ -607,7 +618,9 @@ SELECT substr(f1, 99995, 10) from toasttest;
|
|||||||
--------
|
--------
|
||||||
567890
|
567890
|
||||||
567890
|
567890
|
||||||
(2 rows)
|
567890
|
||||||
|
567890
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
DROP TABLE toasttest;
|
DROP TABLE toasttest;
|
||||||
--
|
--
|
||||||
@@ -616,6 +629,13 @@ DROP TABLE toasttest;
|
|||||||
CREATE TABLE toasttest(f1 bytea);
|
CREATE TABLE toasttest(f1 bytea);
|
||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
--
|
||||||
|
-- Ensure that some values are uncompressed, to test the faster substring
|
||||||
|
-- operation used in that case
|
||||||
|
--
|
||||||
|
alter table toasttest alter column f1 set storage external;
|
||||||
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
@@ -623,7 +643,9 @@ SELECT substr(f1, -1, 5) from toasttest;
|
|||||||
--------
|
--------
|
||||||
123
|
123
|
||||||
123
|
123
|
||||||
(2 rows)
|
123
|
||||||
|
123
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
-- If the length is less than zero, an ERROR is thrown.
|
-- If the length is less than zero, an ERROR is thrown.
|
||||||
SELECT substr(f1, 5, -1) from toasttest;
|
SELECT substr(f1, 5, -1) from toasttest;
|
||||||
@@ -635,7 +657,9 @@ SELECT substr(f1, 99995) from toasttest;
|
|||||||
--------
|
--------
|
||||||
567890
|
567890
|
||||||
567890
|
567890
|
||||||
(2 rows)
|
567890
|
||||||
|
567890
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
-- If start plus length is > string length, the result is truncated to
|
-- If start plus length is > string length, the result is truncated to
|
||||||
-- string length
|
-- string length
|
||||||
@@ -644,7 +668,9 @@ SELECT substr(f1, 99995, 10) from toasttest;
|
|||||||
--------
|
--------
|
||||||
567890
|
567890
|
||||||
567890
|
567890
|
||||||
(2 rows)
|
567890
|
||||||
|
567890
|
||||||
|
(4 rows)
|
||||||
|
|
||||||
DROP TABLE toasttest;
|
DROP TABLE toasttest;
|
||||||
--
|
--
|
||||||
|
@@ -206,6 +206,14 @@ CREATE TABLE toasttest(f1 text);
|
|||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ensure that some values are uncompressed, to test the faster substring
|
||||||
|
-- operation used in that case
|
||||||
|
--
|
||||||
|
alter table toasttest alter column f1 set storage external;
|
||||||
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
@@ -231,6 +239,14 @@ CREATE TABLE toasttest(f1 bytea);
|
|||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ensure that some values are uncompressed, to test the faster substring
|
||||||
|
-- operation used in that case
|
||||||
|
--
|
||||||
|
alter table toasttest alter column f1 set storage external;
|
||||||
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
|
Reference in New Issue
Block a user