Skip to content

Commit e2aef49

Browse files
Jan WieckJan Wieck
authored andcommitted
Added empty TOASTER files and corrected some minor glitches
in regression tests. Jan
1 parent 2c29c96 commit e2aef49

File tree

11 files changed

+187
-14
lines changed

11 files changed

+187
-14
lines changed

src/backend/access/common/tupdesc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.58 1999/12/20 10:40:38 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.59 1999/12/21 00:06:39 wieck Exp $
1111
*
1212
* NOTES
1313
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -378,8 +378,12 @@ TupleDescInitEntry(TupleDesc desc,
378378
* relations for automatic move off into "secondary" relation.
379379
* Jan
380380
*/
381-
#ifdef LONG_ATTRIBUTES_NOW_IMPLEMENTED_FOR_ALL_VARLENA_DATA_TYPES
382-
att->attcanlong = (att->attlen == -1) ? 'e' : 'p';
381+
#ifdef TUPLE_TOASTER_ACTIVE
382+
#ifdef TUPLE_TOASTER_ALL_TYPES
383+
att->attstorage = (att->attlen == -1) ? 'e' : 'p';
384+
#else
385+
att->attstorage = 'p';
386+
#endif
383387
#else
384388
att->attstorage = 'p';
385389
#endif

src/backend/access/heap/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/heap
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/access/heap/Makefile,v 1.8 1999/12/13 22:32:24 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/access/heap/Makefile,v 1.9 1999/12/21 00:06:40 wieck Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,7 +13,7 @@ include ../../../Makefile.global
1313

1414
CFLAGS += -I../..
1515

16-
OBJS = heapam.o hio.o stats.o
16+
OBJS = heapam.o hio.o stats.o tuptoaster.o
1717

1818
all: SUBSYS.o
1919

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.61 1999/12/16 22:19:36 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.62 1999/12/21 00:06:40 wieck Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -78,6 +78,7 @@
7878
#include "access/heapam.h"
7979
#include "access/hio.h"
8080
#include "access/valid.h"
81+
#include "access/tuptoaster.h"
8182
#include "catalog/catalog.h"
8283
#include "miscadmin.h"
8384
#include "storage/smgr.h"

src/backend/access/heap/tuptoaster.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* tuptoaster.c
4+
* Support routines for external and compressed storage of
5+
* variable size attributes.
6+
*
7+
* Copyright (c) 2000, PostgreSQL Development Team
8+
*
9+
*
10+
* IDENTIFICATION
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.1 1999/12/21 00:06:40 wieck Exp $
12+
*
13+
*
14+
* INTERFACE ROUTINES
15+
* heap_tuple_toast_attrs -
16+
* Try to make a given tuple fit into one page by compressing
17+
* or moving off attributes
18+
*
19+
*-------------------------------------------------------------------------
20+
*/
21+
22+
#include "postgres.h"
23+
24+
#include "access/heapam.h"
25+
#include "access/tuptoaster.h"
26+
#include "catalog/catalog.h"
27+
#include "utils/rel.h"
28+
29+
30+
#ifdef TUPLE_TOASTER_ACTIVE
31+
32+
void
33+
heap_tuple_toast_attrs (Relation rel, HeapTuple newtup, HeapTuple oldtup)
34+
{
35+
return;
36+
}
37+
38+
39+
varattrib *
40+
heap_tuple_untoast_attr (varattrib *attr)
41+
{
42+
elog(ERROR, "heap_tuple_untoast_attr() called");
43+
}
44+
45+
46+
#endif /* TUPLE_TOASTER_ACTIVE */

src/include/access/htup.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: htup.h,v 1.26 1999/12/16 22:19:58 wieck Exp $
9+
* $Id: htup.h,v 1.27 1999/12/21 00:06:42 wieck Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -125,6 +125,11 @@ typedef HeapTupleData *HeapTuple;
125125
#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
126126
#define HEAP_HASVARLENA 0x0002 /* has variable length
127127
* attribute(s) */
128+
#define HEAP_HASEXTERNAL 0x0004 /* has external stored */
129+
/* attribute(s) */
130+
#define HEAP_HASCOMPRESSED 0x0008 /* has compressed stored */
131+
/* attribute(s) */
132+
#define HEAP_HASEXTENDED 0x000C /* the two above combined */
128133
#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
129134
#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
130135
#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
@@ -144,4 +149,13 @@ typedef HeapTupleData *HeapTuple;
144149
#define HeapTupleAllFixed(tuple) \
145150
(!(((HeapTuple) (tuple))->t_data->t_infomask & HEAP_HASVARLENA))
146151

152+
#define HeapTupleHasExternal(tuple) \
153+
((((HeapTuple)(tuple))->t_data->t_infomask & HEAP_HASEXTERNAL) != 0)
154+
155+
#define HeapTupleHasCompressed(tuple) \
156+
((((HeapTuple)(tuple))->t_data->t_infomask & HEAP_HASCOMPRESSED) != 0)
157+
158+
#define HeapTupleHasExtended(tuple) \
159+
((((HeapTuple)(tuple))->t_data->t_infomask & HEAP_HASEXTENDED) != 0)
160+
147161
#endif /* HTUP_H */

src/include/access/tupmacs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: tupmacs.h,v 1.11 1999/07/15 15:20:56 momjian Exp $
9+
* $Id: tupmacs.h,v 1.12 1999/12/21 00:06:42 wieck Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -88,7 +88,7 @@
8888
) \
8989
: \
9090
( \
91-
(cur_offset) + VARSIZE(DatumGetPointer(attval)) \
91+
(cur_offset) + VARATT_SIZE(DatumGetPointer(attval)) \
9292
) \
9393
)
9494

src/include/access/tuptoaster.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* tuptoaster.h
4+
* POSTGRES definitions for external and compressed storage
5+
* of variable size attributes.
6+
*
7+
* Copyright (c) 2000, PostgreSQL Development Team
8+
*
9+
* $Id: tuptoaster.h,v 1.1 1999/12/21 00:06:42 wieck Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef TUPTOASTER_H
14+
#define TUPTOASTER_H
15+
16+
#ifdef TUPLE_TOASTER_ACTIVE
17+
18+
#include "postgres.h"
19+
#include "access/heapam.h"
20+
#include "access/htup.h"
21+
#include "access/tupmacs.h"
22+
#include "utils/rel.h"
23+
24+
25+
extern void heap_tuple_toast_attrs(Relation rel,
26+
HeapTuple newtup, HeapTuple oldtup);
27+
28+
extern varattrib *heap_tuple_untoast_attr(varattrib *attr);
29+
30+
#endif /* TUPLE_TOASTER_ACTIVE */
31+
32+
33+
#endif /* TUPTOASTER_H */

src/include/postgres.h

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1995, Regents of the University of California
88
*
9-
* $Id: postgres.h,v 1.30 1999/11/07 23:08:32 momjian Exp $
9+
* $Id: postgres.h,v 1.31 1999/12/21 00:06:41 wieck Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -104,6 +104,79 @@ typedef struct varlena text;
104104
typedef int2 int28[8];
105105
typedef Oid oid8[8];
106106

107+
108+
/*
109+
* Proposed new layout for variable length attributes
110+
* DO NOT USE YET - Jan
111+
*/
112+
#undef TUPLE_TOASTER_ACTIVE
113+
#undef TUPLE_TOASTER_ALL_TYPES
114+
115+
#ifdef TUPLE_TOASTER_ACTIVE
116+
typedef struct varattrib
117+
{
118+
int32 va_header; /* External/compressed storage */
119+
/* flags and item size */
120+
union
121+
{
122+
struct
123+
{
124+
int32 va_rawsize; /* Plain data size */
125+
} va_compressed; /* Compressed stored attribute */
126+
127+
struct
128+
{
129+
int32 va_rawsize; /* Plain data size */
130+
Oid va_valueid; /* Unique identifier of value */
131+
Oid va_longrelid; /* RelID where to find chunks */
132+
Oid va_rowid; /* Main tables row Oid */
133+
int16 va_attno; /* Main tables attno */
134+
} va_external; /* External stored attribute */
135+
136+
char va_data[1]; /* Plain stored attribute */
137+
} va_content;
138+
} varattrib;
139+
140+
#define VARATT_FLAG_EXTERNAL 0x8000
141+
#define VARATT_FLAG_COMPRESSED 0x4000
142+
#define VARATT_MASK_FLAGS 0xc000
143+
#define VARATT_MASK_SIZE 0x3fff
144+
145+
#define VARATT_SIZEP(_PTR) (((varattrib *)(_PTR))->va_header)
146+
#define VARATT_SIZE(PTR) (VARATT_SIZEP(PTR) & VARATT_MASK_SIZE)
147+
#define VARATT_DATA(PTR) (((varattrib *)(PTR))->va_content.va_data)
148+
149+
#define VARATT_IS_EXTENDED(PTR) \
150+
((VARATT_SIZEP(PTR) & VARATT_MASK_FLAGS) != 0)
151+
#define VARATT_IS_EXTERNAL(PTR) \
152+
((VARATT_SIZEP(PTR) & VARATT_FLAG_EXTERNAL) != 0)
153+
#define VARATT_IS_COMPRESSED(PTR) \
154+
((VARATT_SIZEP(PTR) & VARATT_FLAG_COMPRESSED) != 0)
155+
156+
/* ----------
157+
* This is regularly declared in access/tuptoaster.h,
158+
* but we don't want to include that into every source,
159+
* so we (evil evil evil) declare it here once more.
160+
* ----------
161+
*/
162+
extern varattrib *heap_tuple_untoast_attr(varattrib *attr);
163+
164+
#define VARATT_GETPLAIN(_ARG,_VAR) { \
165+
if (VARATTR_IS_EXTENDED(_ARG)) \
166+
(_VAR) = (void *)heap_tuple_untoast_attr(_ARG); \
167+
else \
168+
(_VAR) = (_ARG); \
169+
}
170+
#define VARATT_FREE(_ARG,VAR) { \
171+
if ((void *)(_VAR) != (void *)(_ARG)) \
172+
pfree((void *)(_VAR)); \
173+
}
174+
#else /* TUPLE_TOASTER_ACTIVE */
175+
#define VARATT_SIZE(__PTR) VARSIZE(__PTR)
176+
#define VARATT_SIZEP(__PTR) VARSIZE(__PTR)
177+
#endif /* TUPLE_TOASTER_ACTIVE */
178+
179+
107180
/* We want NameData to have length NAMEDATALEN and int alignment,
108181
* because that's how the data type 'name' is defined in pg_type.
109182
* Use a union to make sure the compiler agrees.

src/test/regress/expected/opr_sanity.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ FROM pg_proc as p1
33
WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR
44
p1.pronargs < 0 OR p1.pronargs > 9)
55
AND p1.proname !~ '^pl[^_]+_call_handler$'
6-
AND p1.proname !~ '^RI_FKey_';
6+
AND p1.proname !~ '^RI_FKey_'
7+
AND p1.proname != 'update_pg_pwd';
78
oid|proname
89
---+-------
910
(0 rows)

src/test/regress/expected/rules.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ a| b
128128
2|13
129129
(3 rows)
130130

131-
QUERY: delete from rtest_v1 where b = 12;
132-
QUERY: select * from rtest_v1;
133131
** Remember the delete rule on rtest_v1: It says
134132
** DO INSTEAD DELETE FROM rtest_t1 WHERE a = old.a
135133
** So this time both rows with a = 2 must get deleted
134+
QUERY: delete from rtest_v1 where b = 12;
135+
QUERY: select * from rtest_v1;
136136
a| b
137137
-+--
138138
1|11

src/test/regress/sql/opr_sanity.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ FROM pg_proc as p1
2828
WHERE (p1.prolang = 0 OR p1.prorettype = 0 OR
2929
p1.pronargs < 0 OR p1.pronargs > 9)
3030
AND p1.proname !~ '^pl[^_]+_call_handler$'
31-
AND p1.proname !~ '^RI_FKey_';
31+
AND p1.proname !~ '^RI_FKey_'
32+
AND p1.proname != 'update_pg_pwd';
3233

3334
-- Look for conflicting proc definitions (same names and input datatypes).
3435

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy