Bruce Momjian 03194432de 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
2002-03-05 05:33:31 +00:00

76 lines
2.0 KiB
C

/*-------------------------------------------------------------------------
*
* command.h
* prototypes for command.c.
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: command.h,v 1.33 2002/03/05 05:33:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef COMMAND_H
#define COMMAND_H
#include "utils/portal.h"
/*
* PerformPortalFetch
* Performs the POSTQUEL function FETCH. Fetches count (or all if 0)
* tuples in portal with name in the forward direction iff goForward.
*
* Exceptions:
* BadArg if forward invalid.
* "ERROR" if portal not found.
*/
extern void PerformPortalFetch(char *name, bool forward, int count,
CommandDest dest, char *completionTag);
/*
* PerformPortalClose
* Performs the POSTQUEL function CLOSE.
*/
extern void PerformPortalClose(char *name, CommandDest dest);
extern void PortalCleanup(Portal portal);
/*
* ALTER TABLE variants
*/
extern void AlterTableAddColumn(const char *relationName,
bool inh, ColumnDef *colDef);
extern void AlterTableAlterColumnDefault(const char *relationName,
bool inh, const char *colName,
Node *newDefault);
extern void AlterTableAlterColumnFlags(const char *relationName,
bool inh, const char *colName,
Node *flagValue, const char *flagType);
extern void AlterTableDropColumn(const char *relationName,
bool inh, const char *colName,
int behavior);
extern void AlterTableAddConstraint(char *relationName,
bool inh, List *newConstraints);
extern void AlterTableDropConstraint(const char *relationName,
bool inh, const char *constrName,
int behavior);
extern void AlterTableCreateToastTable(const char *relationName,
bool silent);
extern void AlterTableOwner(const char *relationName, const char *newOwnerName);
/*
* LOCK
*/
extern void LockTableCommand(LockStmt *lockstmt);
#endif /* COMMAND_H */