aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-03-05 05:33:31 +0000
committerBruce Momjian <bruce@momjian.us>2002-03-05 05:33:31 +0000
commit03194432de712f7afb4ddc2ade2bc44f0536dae1 (patch)
tree8a864adc9b1d924fe8f6a919b51d34cef4a4ef01 /src/backend/parser
parent276fc7ce829404627075ebf8ed5ee3039923eb2b (diff)
downloadpostgresql-03194432de712f7afb4ddc2ade2bc44f0536dae1.tar.gz
postgresql-03194432de712f7afb4ddc2ade2bc44f0536dae1.zip
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
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y16
-rw-r--r--src/backend/parser/keywords.c3
2 files changed, 16 insertions, 3 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 9ff44e9d930..dfc8898653c 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.283 2002/03/02 21:39:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.284 2002/03/05 05:33:14 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -364,7 +364,7 @@ static void doNegateFloat(Value *v);
OFFSET, OIDS, OPERATOR, OWNER, PASSWORD, PROCEDURAL,
REINDEX, RENAME, RESET, RETURNS, ROW, RULE,
SEQUENCE, SETOF, SHARE, SHOW, START, STATEMENT,
- STATISTICS, STDIN, STDOUT, SYSID,
+ STATISTICS, STDIN, STDOUT, STORAGE, SYSID,
TEMP, TEMPLATE, TOAST, TRUNCATE, TRUSTED,
UNLISTEN, UNTIL, VACUUM, VALID, VERBOSE, VERSION
@@ -1117,6 +1117,17 @@ AlterTableStmt:
n->def = (Node *) makeInteger($9);
$$ = (Node *)n;
}
+/* ALTER TABLE <relation> ALTER [COLUMN] <colname> SET STORAGE <storagemode> */
+ | ALTER TABLE relation_expr ALTER opt_column ColId SET STORAGE ColId
+ {
+ AlterTableStmt *n = makeNode(AlterTableStmt);
+ n->subtype = 'M';
+ n->relname = $3->relname;
+ n->inhOpt = $3->inhOpt;
+ n->name = $6;
+ n->def = (Node *) makeString($9);
+ $$ = (Node *)n;
+ }
/* ALTER TABLE <relation> DROP [COLUMN] <colname> {RESTRICT|CASCADE} */
| ALTER TABLE relation_expr DROP opt_column ColId drop_behavior
{
@@ -5959,6 +5970,7 @@ unreserved_keyword:
| STATISTICS { $$ = "statistics"; }
| STDIN { $$ = "stdin"; }
| STDOUT { $$ = "stdout"; }
+ | STORAGE { $$ = "storage"; }
| SYSID { $$ = "sysid"; }
| TEMP { $$ = "temp"; }
| TEMPLATE { $$ = "template"; }
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index 12b05c6bcd1..eaa0f7fa2b0 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.100 2002/02/18 23:11:18 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.101 2002/03/05 05:33:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -243,6 +243,7 @@ static ScanKeyword ScanKeywords[] = {
{"statistics", STATISTICS},
{"stdin", STDIN},
{"stdout", STDOUT},
+ {"storage", STORAGE},
{"substring", SUBSTRING},
{"sysid", SYSID},
{"table", TABLE},