mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Type lztext is toast.
(Sorry, couldn't help it...) Removed type filename as well, since it's unused and probably useless. INITDB FORCED, because pg_rewrite columns are now plain text again.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.180 2000/07/28 14:47:23 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.181 2000/07/30 22:13:50 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -2360,14 +2360,18 @@ index_elem: attr_name opt_class
|
||||
opt_class: class
|
||||
{
|
||||
/*
|
||||
* Release 7.0 removed network_ops, timespan_ops, and datetime_ops,
|
||||
* so we suppress it from being passed to the backend so the default
|
||||
* *_ops is used. This can be removed in some later release.
|
||||
* bjm 2000/02/07
|
||||
* Release 7.0 removed network_ops, timespan_ops, and
|
||||
* datetime_ops, so we suppress it from being passed to
|
||||
* the parser so the default *_ops is used. This can be
|
||||
* removed in some later release. bjm 2000/02/07
|
||||
*
|
||||
* Release 7.1 removes lztext_ops, so suppress that too
|
||||
* for a while. tgl 2000/07/30
|
||||
*/
|
||||
if (strcmp($1, "network_ops") != 0 &&
|
||||
strcmp($1, "timespan_ops") != 0 &&
|
||||
strcmp($1, "datetime_ops") != 0)
|
||||
strcmp($1, "datetime_ops") != 0 &&
|
||||
strcmp($1, "lztext_ops") != 0)
|
||||
$$ = $1;
|
||||
else
|
||||
$$ = NULL;
|
||||
@@ -5884,6 +5888,10 @@ xlateSqlFunc(char *name)
|
||||
*
|
||||
* Convert "datetime" and "timespan" to allow a transition to SQL92 type names.
|
||||
* Remove this translation for v7.1 - thomas 2000-03-25
|
||||
*
|
||||
* Convert "lztext" to "text" to allow forward compatibility for anyone using
|
||||
* the undocumented "lztext" type in 7.0. This can go away in 7.2 or later
|
||||
* - tgl 2000-07-30
|
||||
*/
|
||||
static char *
|
||||
xlateSqlType(char *name)
|
||||
@@ -5905,6 +5913,8 @@ xlateSqlType(char *name)
|
||||
return "timestamp";
|
||||
else if (strcmp(name, "timespan") == 0)
|
||||
return "interval";
|
||||
else if (strcmp(name, "lztext") == 0)
|
||||
return "text";
|
||||
else if (strcmp(name, "boolean") == 0)
|
||||
return "bool";
|
||||
else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.45 2000/07/05 23:11:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.46 2000/07/30 22:13:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -333,7 +333,6 @@ TypeCategory(Oid inType)
|
||||
case (BPCHAROID):
|
||||
case (VARCHAROID):
|
||||
case (TEXTOID):
|
||||
case (LZTEXTOID):
|
||||
result = STRING_TYPE;
|
||||
break;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.48 2000/06/30 07:04:22 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.49 2000/07/30 22:13:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -65,8 +65,8 @@ InsertRule(char *rulname,
|
||||
values[i++] = ObjectIdGetDatum(eventrel_oid);
|
||||
values[i++] = Int16GetDatum(evslot_index);
|
||||
values[i++] = BoolGetDatum(evinstead);
|
||||
values[i++] = PointerGetDatum(lztextin(evqual));
|
||||
values[i++] = PointerGetDatum(lztextin(actiontree));
|
||||
values[i++] = DirectFunctionCall1(textin, CStringGetDatum(evqual));
|
||||
values[i++] = DirectFunctionCall1(textin, CStringGetDatum(actiontree));
|
||||
|
||||
/* ----------------
|
||||
* create a new pg_rewrite tuple
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile for utils/adt
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.40 2000/07/22 03:34:43 tgl Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.41 2000/07/30 22:13:52 tgl Exp $
|
||||
#
|
||||
|
||||
subdir = src/backend/utils/adt
|
||||
@@ -16,8 +16,8 @@ endif
|
||||
endif
|
||||
|
||||
OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o \
|
||||
date.o datetime.o datum.o filename.o float.o format_type.o \
|
||||
geo_ops.o geo_selfuncs.o int.o int8.o like.o lztext.o \
|
||||
date.o datetime.o datum.o float.o format_type.o \
|
||||
geo_ops.o geo_selfuncs.o int.o int8.o like.o \
|
||||
misc.o nabstime.o name.o not_in.o numeric.o numutils.o \
|
||||
oid.o oracle_compat.o \
|
||||
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* filename.c
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.24 2000/01/26 05:57:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
char *
|
||||
filename_in(char *file)
|
||||
{
|
||||
char *str;
|
||||
int ind = 0;
|
||||
|
||||
/*
|
||||
* XXX - HACK CITY --- REDO should let the shell do expansions
|
||||
* (shexpand)
|
||||
*/
|
||||
|
||||
str = (char *) palloc(MAXPGPATH);
|
||||
str[0] = '\0';
|
||||
if (file[0] == '~')
|
||||
{
|
||||
if (file[1] == '\0' || file[1] == '/')
|
||||
{
|
||||
/* Home directory */
|
||||
|
||||
char *userName;
|
||||
struct passwd *pw;
|
||||
|
||||
userName = GetPgUserName();
|
||||
|
||||
if ((pw = getpwnam(userName)) == NULL)
|
||||
{
|
||||
elog(ERROR, "User %s is not a Unix user on the db server.",
|
||||
userName);
|
||||
}
|
||||
|
||||
strcpy(str, pw->pw_dir);
|
||||
|
||||
ind = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Someone else's directory */
|
||||
char name[17],
|
||||
*p;
|
||||
struct passwd *pw;
|
||||
int len;
|
||||
|
||||
if ((p = (char *) strchr(file, '/')) == NULL)
|
||||
{
|
||||
strcpy(name, file + 1);
|
||||
len = strlen(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (p - file) - 1;
|
||||
StrNCpy(name, file + 1, len + 1);
|
||||
}
|
||||
/* printf("name: %s\n"); */
|
||||
if ((pw = getpwnam(name)) == NULL)
|
||||
{
|
||||
elog(ERROR, "No such user: %s\n", name);
|
||||
ind = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(str, pw->pw_dir);
|
||||
ind = len + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (file[0] == '$')
|
||||
{ /* $POSTGRESHOME, etc. expand it. */
|
||||
char environment[80],
|
||||
*envirp,
|
||||
*p;
|
||||
int len;
|
||||
|
||||
if ((p = (char *) strchr(file, '/')) == NULL)
|
||||
{
|
||||
strcpy(environment, file + 1);
|
||||
len = strlen(environment);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (p - file) - 1;
|
||||
StrNCpy(environment, file + 1, len + 1);
|
||||
}
|
||||
envirp = getenv(environment);
|
||||
if (envirp)
|
||||
{
|
||||
strcpy(str, envirp);
|
||||
ind = len + 1;
|
||||
}
|
||||
else
|
||||
elog(ERROR, "Couldn't find %s in your environment", environment);
|
||||
}
|
||||
else
|
||||
ind = 0;
|
||||
strcat(str, file + ind);
|
||||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
filename_out(char *s)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if (!s)
|
||||
return (char *) NULL;
|
||||
ret = (char *) palloc(strlen(s) + 1);
|
||||
if (!ret)
|
||||
elog(ERROR, "filename_out: palloc failed");
|
||||
return strcpy(ret, s);
|
||||
}
|
||||
@@ -1,359 +0,0 @@
|
||||
/* ----------
|
||||
* lztext.c -
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/lztext.c,v 1.10 2000/07/06 05:48:11 tgl Exp $
|
||||
*
|
||||
* Text type with internal LZ compressed representation. Uses the
|
||||
* standard PostgreSQL compression method.
|
||||
*
|
||||
* This code requires that the LZ compressor found in pg_lzcompress
|
||||
* codes a usable VARSIZE word at the beginning of the output buffer.
|
||||
* ----------
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "postgres.h"
|
||||
#include "utils/builtins.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "mb/pg_wchar.h"
|
||||
#endif
|
||||
|
||||
/* ----------
|
||||
* lztextin -
|
||||
*
|
||||
* Input function for datatype lztext
|
||||
* ----------
|
||||
*/
|
||||
lztext *
|
||||
lztextin(char *str)
|
||||
{
|
||||
lztext *result;
|
||||
int32 rawsize;
|
||||
|
||||
/* ----------
|
||||
* Handle NULL
|
||||
* ----------
|
||||
*/
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
rawsize = strlen(str);
|
||||
result = (lztext *)palloc(VARHDRSZ + rawsize);
|
||||
|
||||
VARATT_SIZEP(result) = VARHDRSZ + rawsize;
|
||||
memcpy(VARATT_DATA(result), str, rawsize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztextout -
|
||||
*
|
||||
* Output function for data type lztext
|
||||
* ----------
|
||||
*/
|
||||
char *
|
||||
lztextout(lztext *lz)
|
||||
{
|
||||
char *result;
|
||||
void *tmp;
|
||||
int32 rawsize;
|
||||
|
||||
/* ----------
|
||||
* Handle NULL
|
||||
* ----------
|
||||
*/
|
||||
if (lz == NULL)
|
||||
{
|
||||
result = (char *) palloc(2);
|
||||
result[0] = '-';
|
||||
result[1] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
VARATT_GETPLAIN(lz, tmp);
|
||||
|
||||
rawsize = VARATT_SIZE(tmp) - VARHDRSZ;
|
||||
result = (char *)palloc(rawsize + 1);
|
||||
memcpy(result, VARATT_DATA(tmp), rawsize);
|
||||
result[rawsize] = '\0';
|
||||
|
||||
VARATT_FREE(lz, tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztextlen -
|
||||
*
|
||||
* Logical length of lztext field (it's the uncompressed size
|
||||
* of the original data).
|
||||
* ----------
|
||||
*/
|
||||
int32
|
||||
lztextlen(lztext *lz)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
unsigned char *s1,
|
||||
*s2;
|
||||
int len;
|
||||
int l;
|
||||
int wl;
|
||||
|
||||
#endif
|
||||
/* ----------
|
||||
* Handle NULL
|
||||
* ----------
|
||||
*/
|
||||
if (lz == NULL)
|
||||
return 0;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
len = 0;
|
||||
s1 = s2 = (unsigned char *) lztextout(lz);
|
||||
l = strlen(s2);
|
||||
while (l > 0)
|
||||
{
|
||||
wl = pg_mblen(s1);
|
||||
l -= wl;
|
||||
s1 += wl;
|
||||
len++;
|
||||
}
|
||||
pfree((char *) s2);
|
||||
return (len);
|
||||
#else
|
||||
/* ----------
|
||||
* without multibyte support, it's the remembered rawsize
|
||||
* ----------
|
||||
*/
|
||||
if (!VARATT_IS_EXTENDED(lz))
|
||||
return VARATT_SIZE(lz) - VARHDRSZ;
|
||||
|
||||
if (VARATT_IS_EXTERNAL(lz))
|
||||
return lz->va_content.va_external.va_rawsize;
|
||||
|
||||
return lz->va_content.va_compressed.va_rawsize;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztextoctetlen -
|
||||
*
|
||||
* Physical length of lztext field (it's the compressed size
|
||||
* plus the rawsize field).
|
||||
* ----------
|
||||
*/
|
||||
int32
|
||||
lztextoctetlen(lztext *lz)
|
||||
{
|
||||
/* ----------
|
||||
* Handle NULL
|
||||
* ----------
|
||||
*/
|
||||
if (lz == NULL)
|
||||
return 0;
|
||||
|
||||
if (!VARATT_IS_EXTERNAL(lz))
|
||||
return VARATT_SIZE(lz) - VARHDRSZ;
|
||||
|
||||
return lz->va_content.va_external.va_extsize;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* text_lztext -
|
||||
*
|
||||
* Convert text to lztext
|
||||
* ----------
|
||||
*/
|
||||
Datum
|
||||
text_lztext(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *txt = PG_GETARG_TEXT_P(0);
|
||||
lztext *result;
|
||||
int32 rawsize;
|
||||
|
||||
/* ----------
|
||||
* Copy the entire attribute
|
||||
* ----------
|
||||
*/
|
||||
rawsize = VARSIZE(txt) - VARHDRSZ;
|
||||
result = (lztext *)palloc(rawsize + VARHDRSZ);
|
||||
VARATT_SIZEP(result) = rawsize + VARHDRSZ;
|
||||
memcpy(VARATT_DATA(result), VARATT_DATA(txt), rawsize);
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztext_text -
|
||||
*
|
||||
* Convert lztext to text
|
||||
* ----------
|
||||
*/
|
||||
text *
|
||||
lztext_text(lztext *lz)
|
||||
{
|
||||
text *result;
|
||||
lztext *tmp;
|
||||
int32 rawsize;
|
||||
|
||||
/* ----------
|
||||
* Handle NULL
|
||||
* ----------
|
||||
*/
|
||||
if (lz == NULL)
|
||||
return NULL;
|
||||
|
||||
VARATT_GETPLAIN(lz, tmp);
|
||||
|
||||
rawsize = VARATT_SIZE(tmp) - VARHDRSZ;
|
||||
result = (text *)palloc(rawsize + VARHDRSZ);
|
||||
VARATT_SIZEP(result) = rawsize + VARHDRSZ;
|
||||
memcpy(VARATT_DATA(result), VARATT_DATA(tmp), rawsize);
|
||||
|
||||
VARATT_FREE(lz, tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztext_cmp -
|
||||
*
|
||||
* Comparision function for two lztext datum's.
|
||||
*
|
||||
* Returns -1, 0 or 1.
|
||||
* ----------
|
||||
*/
|
||||
int32
|
||||
lztext_cmp(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
#ifdef USE_LOCALE
|
||||
|
||||
char *cp1;
|
||||
char *cp2;
|
||||
int result;
|
||||
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return (int32) 0;
|
||||
|
||||
cp1 = lztextout(lz1);
|
||||
cp2 = lztextout(lz2);
|
||||
|
||||
result = strcoll(cp1, cp2);
|
||||
|
||||
pfree(cp1);
|
||||
pfree(cp2);
|
||||
|
||||
return result;
|
||||
|
||||
#else /* !USE_LOCALE */
|
||||
|
||||
int result;
|
||||
char *p1 = NULL;
|
||||
char *p2 = NULL;
|
||||
int size1;
|
||||
int size2;
|
||||
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return 0;
|
||||
|
||||
VARATT_GETPLAIN(lz1, p1);
|
||||
VARATT_GETPLAIN(lz2, p2);
|
||||
|
||||
size1 = VARATT_SIZE(p1) - VARHDRSZ;
|
||||
size2 = VARATT_SIZE(p2) - VARHDRSZ;
|
||||
result = memcmp(VARATT_DATA(p1), VARATT_DATA(p2),
|
||||
(size1 < size2) ? size1 : size2);
|
||||
if (result == 0)
|
||||
{
|
||||
if (size1 > size2)
|
||||
result = 1;
|
||||
else if (size1 < size2)
|
||||
result = -1;
|
||||
}
|
||||
|
||||
VARATT_FREE(lz2, p2);
|
||||
VARATT_FREE(lz1, p1);
|
||||
|
||||
return result;
|
||||
|
||||
#endif /* USE_LOCALE */
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* lztext_eq ... -
|
||||
*
|
||||
* =, !=, >, >=, < and <= operator functions for two
|
||||
* lztext datums.
|
||||
* ----------
|
||||
*/
|
||||
bool
|
||||
lztext_eq(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) == 0);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
lztext_ne(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) != 0);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
lztext_gt(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) > 0);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
lztext_ge(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) >= 0);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
lztext_lt(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) < 0);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
lztext_le(lztext *lz1, lztext *lz2)
|
||||
{
|
||||
if (lz1 == NULL || lz2 == NULL)
|
||||
return false;
|
||||
|
||||
return (bool) (lztext_cmp(lz1, lz2) <= 0);
|
||||
}
|
||||
10
src/backend/utils/cache/relcache.c
vendored
10
src/backend/utils/cache/relcache.c
vendored
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.107 2000/07/14 22:17:50 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.108 2000/07/30 22:13:55 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -775,7 +775,9 @@ RelationBuildRuleLock(Relation relation)
|
||||
Anum_pg_rewrite_ev_action,
|
||||
pg_rewrite_tupdesc,
|
||||
&isnull);
|
||||
ruleaction_str = lztextout((lztext *) DatumGetPointer(ruleaction));
|
||||
Assert(! isnull);
|
||||
ruleaction_str = DatumGetCString(DirectFunctionCall1(textout,
|
||||
ruleaction));
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
rule->actions = (List *) stringToNode(ruleaction_str);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
@@ -785,7 +787,9 @@ RelationBuildRuleLock(Relation relation)
|
||||
Anum_pg_rewrite_ev_qual,
|
||||
pg_rewrite_tupdesc,
|
||||
&isnull);
|
||||
rule_evqual_str = lztextout((lztext *) DatumGetPointer(rule_evqual));
|
||||
Assert(! isnull);
|
||||
rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
|
||||
rule_evqual));
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
rule->qual = (Node *) stringToNode(rule_evqual_str);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
||||
Reference in New Issue
Block a user