Skip to content

Commit 0a8fb5a

Browse files
committed
Upgrade to PyGreSQL (2.4)
1 parent 9487ad8 commit 0a8fb5a

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

src/backend/catalog/heap.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.80 1999/05/13 07:28:26 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.81 1999/05/19 16:46:10 momjian Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -1514,7 +1514,7 @@ StoreAttrDefault(Relation rel, AttrDefault *attrdef)
15141514
char nulls[4] = {' ', ' ', ' ', ' '};
15151515
extern GlobalMemory CacheCxt;
15161516

1517-
start:;
1517+
start:
15181518
/* Surround table name with double quotes to allow mixed-case and
15191519
* whitespaces in names. - BGA 1998-11-14
15201520
*/
@@ -1537,7 +1537,21 @@ start:;
15371537

15381538
if (type != atp->atttypid)
15391539
{
1540-
if (IS_BINARY_COMPATIBLE(type, atp->atttypid))
1540+
/*
1541+
* Though these types are binary compatible, bpchar has a fixed
1542+
* length on the disk, requiring non-bpchar types to be padded
1543+
* before storage in the default table. bjm 1999/05/18
1544+
*/
1545+
if (atp->atttypid == BPCHAROID &&
1546+
(type == TEXTOID || type == BPCHAROID || type == UNKNOWNOID))
1547+
{
1548+
if (can_coerce_type(1, &(type), &(atp->atttypid)))
1549+
expr = coerce_type(NULL, (Node *)expr, type, atp->atttypid);
1550+
else
1551+
elog(ERROR, "DEFAULT clause const type '%s' can not be converted to char().",
1552+
typeidTypeName(type));
1553+
}
1554+
else if (IS_BINARY_COMPATIBLE(type, atp->atttypid))
15411555
; /* use without change */
15421556
else if (can_coerce_type(1, &(type), &(atp->atttypid)))
15431557
expr = coerce_type(NULL, (Node *)expr, type, atp->atttypid);
@@ -1556,8 +1570,7 @@ start:;
15561570

15571571
adbin = nodeToString(expr);
15581572
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
1559-
attrdef->adbin = (char *) palloc(strlen(adbin) + 1);
1560-
strcpy(attrdef->adbin, adbin);
1573+
attrdef->adbin = pstrdup(adbin);
15611574
(void) MemoryContextSwitchTo(oldcxt);
15621575
pfree(adbin);
15631576

src/backend/nodes/outfuncs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: outfuncs.c,v 1.83 1999/05/18 21:34:28 tgl Exp $
8+
* $Id: outfuncs.c,v 1.84 1999/05/19 16:46:11 momjian Exp $
99
*
1010
* NOTES
1111
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -1203,18 +1203,14 @@ _outDatum(StringInfo str, Datum value, Oid type)
12031203
s = (char *) (&value);
12041204
appendStringInfo(str, " %d [ ", length);
12051205
for (i = 0; i < sizeof(Datum); i++)
1206-
{
12071206
appendStringInfo(str, " %d ", (int) (s[i]));
1208-
}
12091207
appendStringInfo(str, "] ");
12101208
}
12111209
else
12121210
{ /* !byValue */
12131211
s = (char *) DatumGetPointer(value);
12141212
if (!PointerIsValid(s))
1215-
{
12161213
appendStringInfo(str, " 0 [ ] ");
1217-
}
12181214
else
12191215
{
12201216
/*

src/backend/nodes/read.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.14 1999/02/13 23:16:01 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.15 1999/05/19 16:46:11 momjian Exp $
1212
*
1313
* HISTORY
1414
* AUTHOR DATE MAJOR EVENT
@@ -26,7 +26,7 @@
2626

2727
/*
2828
* stringToNode -
29-
* returns a Node with a given legal ascii representation
29+
* returns a Node with a given legal ASCII representation
3030
*/
3131
void *
3232
stringToNode(char *str)

src/backend/parser/parse_coerce.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.12 1999/05/10 00:45:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.13 1999/05/19 16:46:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -75,7 +75,6 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId)
7575
*/
7676
else if (inputTypeId != UNKNOWNOID)
7777
{
78-
7978
/*
8079
* We already know there is a function which will do this, so
8180
* let's use it

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