Skip to content

Commit ae526b4

Browse files
committed
Another round of updates for new fmgr, mostly in the datetime code.
1 parent 20ad43b commit ae526b4

File tree

27 files changed

+2019
-1820
lines changed

27 files changed

+2019
-1820
lines changed

contrib/lo/lo.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PostgreSQL type definitions for managed LargeObjects.
33
*
4-
* $Id: lo.c,v 1.3 2000/05/29 01:59:02 tgl Exp $
4+
* $Id: lo.c,v 1.4 2000/06/09 01:10:58 tgl Exp $
55
*
66
*/
77

@@ -76,7 +76,8 @@ lo_in(char *str)
7676
/*
7777
* There is no Oid passed, so create a new one
7878
*/
79-
oid = lo_creat(INV_READ | INV_WRITE);
79+
oid = DatumGetObjectId(DirectFunctionCall1(lo_creat,
80+
Int32GetDatum(INV_READ | INV_WRITE)));
8081
if (oid == InvalidOid)
8182
{
8283
elog(ERROR, "lo_in: InvalidOid returned from lo_creat");
@@ -186,7 +187,8 @@ lo_manage(PG_FUNCTION_ARGS)
186187
char *newv = SPI_getvalue(newtuple, tupdesc, attnum);
187188

188189
if ((orig != newv && (orig == NULL || newv == NULL)) || (orig != NULL && newv != NULL && strcmp(orig, newv)))
189-
lo_unlink(atoi(orig));
190+
DirectFunctionCall1(lo_unlink,
191+
ObjectIdGetDatum((Oid) atoi(orig)));
190192

191193
if (newv)
192194
pfree(newv);
@@ -206,7 +208,8 @@ lo_manage(PG_FUNCTION_ARGS)
206208

207209
if (orig != NULL)
208210
{
209-
lo_unlink(atoi(orig));
211+
DirectFunctionCall1(lo_unlink,
212+
ObjectIdGetDatum((Oid) atoi(orig)));
210213

211214
pfree(orig);
212215
}

contrib/spi/moddatetime.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ moddatetime(PG_FUNCTION_ARGS)
6262
tupdesc = rel->rd_att;
6363

6464
/* Get the current datetime. */
65-
newdt = (Datum) timestamp_in("now");
65+
newdt = DirectFunctionCall1(timestamp_in,
66+
CStringGetDatum("now"));
6667

6768
/*
6869
* This gets the position in the turple of the field we want. args[0]

src/backend/access/nbtree/nbtcompare.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.35 2000/06/05 07:28:36 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.36 2000/06/09 01:11:01 tgl Exp $
1212
*
1313
* NOTES
1414
*
@@ -170,9 +170,12 @@ btoidvectorcmp(PG_FUNCTION_ARGS)
170170
PG_RETURN_INT32(0);
171171
}
172172

173-
int32
174-
btabstimecmp(AbsoluteTime a, AbsoluteTime b)
173+
Datum
174+
btabstimecmp(PG_FUNCTION_ARGS)
175175
{
176+
AbsoluteTime a = PG_GETARG_ABSOLUTETIME(0);
177+
AbsoluteTime b = PG_GETARG_ABSOLUTETIME(1);
178+
176179
if (AbsoluteTimeIsBefore(a, b))
177180
PG_RETURN_INT32(-1);
178181
else if (AbsoluteTimeIsBefore(b, a))

src/backend/commands/user.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.57 2000/06/02 03:58:33 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.58 2000/06/09 01:11:04 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -122,8 +122,8 @@ write_password_file(Relation rel)
122122
"%s\n",
123123
nameout(DatumGetName(datum_n)),
124124
null_p ? "" : textout((text *) datum_p),
125-
null_v ? "\\N" : nabstimeout((AbsoluteTime) datum_v) /* this is how the
126-
* parser wants it */
125+
null_v ? "\\N" :
126+
DatumGetCString(DirectFunctionCall1(nabstimeout, datum_v))
127127
);
128128
}
129129
heap_endscan(scan);
@@ -268,7 +268,8 @@ CreateUser(CreateUserStmt *stmt)
268268
if (stmt->password)
269269
new_record[Anum_pg_shadow_passwd - 1] = PointerGetDatum(textin(stmt->password));
270270
if (stmt->validUntil)
271-
new_record[Anum_pg_shadow_valuntil - 1] = PointerGetDatum(nabstimein(stmt->validUntil));
271+
new_record[Anum_pg_shadow_valuntil - 1] =
272+
DirectFunctionCall1(nabstimein, CStringGetDatum(stmt->validUntil));
272273

273274
new_record_nulls[Anum_pg_shadow_usename - 1] = ' ';
274275
new_record_nulls[Anum_pg_shadow_usesysid - 1] = ' ';
@@ -445,7 +446,8 @@ AlterUser(AlterUserStmt *stmt)
445446
/* valid until */
446447
if (stmt->validUntil)
447448
{
448-
new_record[Anum_pg_shadow_valuntil - 1] = PointerGetDatum(nabstimein(stmt->validUntil));
449+
new_record[Anum_pg_shadow_valuntil - 1] =
450+
DirectFunctionCall1(nabstimein, CStringGetDatum(stmt->validUntil));
449451
new_record_nulls[Anum_pg_shadow_valuntil - 1] = ' ';
450452
}
451453
else

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