Skip to content

Commit 0e20c48

Browse files
committed
Revert FETCH/MOVE int64 patch. Was using incorrect checks for
fetch/move in scan.l.
1 parent d387a07 commit 0e20c48

File tree

10 files changed

+51
-115
lines changed

10 files changed

+51
-115
lines changed

src/backend/commands/portalcmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.52 2006/09/02 18:17:17 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.53 2006/09/03 03:19:44 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -177,7 +177,7 @@ PerformPortalFetch(FetchStmt *stmt,
177177
char *completionTag)
178178
{
179179
Portal portal;
180-
int64 nprocessed;
180+
long nprocessed;
181181

182182
/*
183183
* Disallow empty-string cursor name (conflicts with protocol-level
@@ -210,7 +210,7 @@ PerformPortalFetch(FetchStmt *stmt,
210210

211211
/* Return command status if wanted */
212212
if (completionTag)
213-
snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "%s " INT64_FORMAT,
213+
snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "%s %ld",
214214
stmt->ismove ? "MOVE" : "FETCH",
215215
nprocessed);
216216
}

src/backend/executor/spi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.160 2006/09/02 18:17:17 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.161 2006/09/03 03:19:44 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -45,7 +45,7 @@ static int _SPI_pquery(QueryDesc *queryDesc, long tcount);
4545

4646
static void _SPI_error_callback(void *arg);
4747

48-
static void _SPI_cursor_operation(Portal portal, bool forward, int64 count,
48+
static void _SPI_cursor_operation(Portal portal, bool forward, long count,
4949
DestReceiver *dest);
5050

5151
static _SPI_plan *_SPI_copy_plan(_SPI_plan *plan, int location);
@@ -980,7 +980,7 @@ SPI_cursor_find(const char *name)
980980
* Fetch rows in a cursor
981981
*/
982982
void
983-
SPI_cursor_fetch(Portal portal, bool forward, int64 count)
983+
SPI_cursor_fetch(Portal portal, bool forward, long count)
984984
{
985985
_SPI_cursor_operation(portal, forward, count,
986986
CreateDestReceiver(DestSPI, NULL));
@@ -994,7 +994,7 @@ SPI_cursor_fetch(Portal portal, bool forward, int64 count)
994994
* Move in a cursor
995995
*/
996996
void
997-
SPI_cursor_move(Portal portal, bool forward, int64 count)
997+
SPI_cursor_move(Portal portal, bool forward, long count)
998998
{
999999
_SPI_cursor_operation(portal, forward, count, None_Receiver);
10001000
}
@@ -1639,10 +1639,10 @@ _SPI_error_callback(void *arg)
16391639
* Do a FETCH or MOVE in a cursor
16401640
*/
16411641
static void
1642-
_SPI_cursor_operation(Portal portal, bool forward, int64 count,
1642+
_SPI_cursor_operation(Portal portal, bool forward, long count,
16431643
DestReceiver *dest)
16441644
{
1645-
int64 nfetched;
1645+
long nfetched;
16461646

16471647
/* Check that the portal is valid */
16481648
if (!PortalIsValid(portal))

src/backend/parser/gram.y

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.563 2006/09/03 00:46:41 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.564 2006/09/03 03:19:44 momjian Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -116,7 +116,6 @@ static void doNegateFloat(Value *v);
116116
%union
117117
{
118118
int ival;
119-
int64 i64val;
120119
char chr;
121120
char *str;
122121
const char *keyword;
@@ -325,7 +324,6 @@ static void doNegateFloat(Value *v);
325324
%type <boolean> opt_varying opt_timezone
326325

327326
%type <ival> Iconst SignedIconst
328-
%type <i64val> SignedI64const
329327
%type <str> Sconst comment_text
330328
%type <str> RoleId opt_granted_by opt_boolean ColId_or_Sconst
331329
%type <list> var_list var_list_or_default
@@ -450,7 +448,6 @@ static void doNegateFloat(Value *v);
450448
/* Special token types, not actually keywords - see the "lex" file */
451449
%token <str> IDENT FCONST SCONST BCONST XCONST Op
452450
%token <ival> ICONST PARAM
453-
%token <i64val> I64CONST
454451

455452
/* precedence: lowest to highest */
456453
%nonassoc SET /* see relation_expr_opt_alias */
@@ -3359,27 +3356,6 @@ fetch_direction:
33593356
n->howMany = $1;
33603357
$$ = (Node *)n;
33613358
}
3362-
| ABSOLUTE_P SignedI64const
3363-
{
3364-
FetchStmt *n = makeNode(FetchStmt);
3365-
n->direction = FETCH_ABSOLUTE;
3366-
n->howMany = $2;
3367-
$$ = (Node *)n;
3368-
}
3369-
| RELATIVE_P SignedI64const
3370-
{
3371-
FetchStmt *n = makeNode(FetchStmt);
3372-
n->direction = FETCH_RELATIVE;
3373-
n->howMany = $2;
3374-
$$ = (Node *)n;
3375-
}
3376-
| SignedI64const
3377-
{
3378-
FetchStmt *n = makeNode(FetchStmt);
3379-
n->direction = FETCH_FORWARD;
3380-
n->howMany = $1;
3381-
$$ = (Node *)n;
3382-
}
33833359
| ALL
33843360
{
33853361
FetchStmt *n = makeNode(FetchStmt);
@@ -3401,13 +3377,6 @@ fetch_direction:
34013377
n->howMany = $2;
34023378
$$ = (Node *)n;
34033379
}
3404-
| FORWARD SignedI64const
3405-
{
3406-
FetchStmt *n = makeNode(FetchStmt);
3407-
n->direction = FETCH_FORWARD;
3408-
n->howMany = $2;
3409-
$$ = (Node *)n;
3410-
}
34113380
| FORWARD ALL
34123381
{
34133382
FetchStmt *n = makeNode(FetchStmt);
@@ -3429,13 +3398,6 @@ fetch_direction:
34293398
n->howMany = $2;
34303399
$$ = (Node *)n;
34313400
}
3432-
| BACKWARD SignedI64const
3433-
{
3434-
FetchStmt *n = makeNode(FetchStmt);
3435-
n->direction = FETCH_BACKWARD;
3436-
n->howMany = $2;
3437-
$$ = (Node *)n;
3438-
}
34393401
| BACKWARD ALL
34403402
{
34413403
FetchStmt *n = makeNode(FetchStmt);
@@ -8540,9 +8502,6 @@ RoleId: ColId { $$ = $1; };
85408502
SignedIconst: ICONST { $$ = $1; }
85418503
| '-' ICONST { $$ = - $2; }
85428504
;
8543-
SignedI64const: I64CONST { $$ = $1; }
8544-
| '-' I64CONST { $$ = - $2; }
8545-
;
85468505

85478506
/*
85488507
* Name classification hierarchy.

src/backend/parser/scan.l

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
2626
* IDENTIFICATION
27-
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.136 2006/09/02 18:17:17 momjian Exp $
27+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.137 2006/09/03 03:19:44 momjian Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -666,22 +666,6 @@ other .
666666
#endif
667667
)
668668
{
669-
/* For Fetch/Move stmt, convert the string into int64 value */
670-
if((strcmp(yylval.keyword, "fetch")==0) || (strcmp(yylval.keyword, "move")==0))
671-
{
672-
int64 int64Val;
673-
errno = 0;
674-
675-
int64Val = strtoll(yytext, &endptr, 10);
676-
if (*endptr != '\0' || errno == ERANGE)
677-
{
678-
yylval.str = pstrdup(yytext);
679-
return FCONST;
680-
}
681-
yylval.i64val = int64Val;
682-
return I64CONST;
683-
}
684-
685669
/* integer too large, treat it as a float */
686670
yylval.str = pstrdup(yytext);
687671
return FCONST;

src/backend/tcop/postgres.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.504 2006/09/02 18:17:17 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.505 2006/09/03 03:19:44 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1687,7 +1687,7 @@ exec_bind_message(StringInfo input_message)
16871687
* Process an "Execute" message for a portal
16881688
*/
16891689
static void
1690-
exec_execute_message(const char *portal_name, int64 max_rows)
1690+
exec_execute_message(const char *portal_name, long max_rows)
16911691
{
16921692
CommandDest dest;
16931693
DestReceiver *receiver;
@@ -3308,13 +3308,13 @@ PostgresMain(int argc, char *argv[], const char *username)
33083308
case 'E': /* execute */
33093309
{
33103310
const char *portal_name;
3311-
int64 max_rows;
3311+
int max_rows;
33123312

33133313
/* Set statement_timestamp() */
33143314
SetCurrentStatementStartTimestamp();
33153315

33163316
portal_name = pq_getmsgstring(&input_message);
3317-
max_rows = pq_getmsgint64(&input_message);
3317+
max_rows = pq_getmsgint(&input_message, 4);
33183318
pq_getmsgend(&input_message);
33193319

33203320
exec_execute_message(portal_name, max_rows);

0 commit comments

Comments
 (0)