1b-cursor_name-ctxdiff.patch
text/x-patch
Filename: 1b-cursor_name-ctxdiff.patch
Type: text/x-patch
Part: 1
Message:
Re: CommitFest 2009-09, two weeks on
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/backend/parser/gram.y | 22 | 19 |
| src/interfaces/ecpg/preproc/ecpg.addons | 15 | 15 |
| src/interfaces/ecpg/preproc/ecpg.trailer | 2 | 2 |
diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y pgsql.cursor_name/src/backend/parser/gram.y
*** pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y 2009-10-02 23:57:32.000000000 +0200
--- pgsql.cursor_name/src/backend/parser/gram.y 2009-10-03 00:47:53.000000000 +0200
*************** static TypeName *TableFuncTypeName(List
*** 252,258 ****
%type <str> relation_name copy_file_name
database_name access_method_clause access_method attr_name
! index_name name file_name cluster_index_specification
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
opt_class opt_inline_handler opt_validator validator_clause
--- 252,258 ----
%type <str> relation_name copy_file_name
database_name access_method_clause access_method attr_name
! index_name name cursor_name file_name cluster_index_specification
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
opt_class opt_inline_handler opt_validator validator_clause
*************** reloption_elem:
*** 1920,1926 ****
*****************************************************************************/
ClosePortalStmt:
! CLOSE name
{
ClosePortalStmt *n = makeNode(ClosePortalStmt);
n->portalname = $2;
--- 1920,1926 ----
*****************************************************************************/
ClosePortalStmt:
! CLOSE cursor_name
{
ClosePortalStmt *n = makeNode(ClosePortalStmt);
n->portalname = $2;
*************** FetchStmt: FETCH fetch_args
*** 4151,4157 ****
}
;
! fetch_args: name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $1;
--- 4151,4157 ----
}
;
! fetch_args: cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $1;
*************** fetch_args: name
*** 4159,4165 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $2;
--- 4159,4165 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $2;
*************** fetch_args: name
*** 4167,4173 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | NEXT opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4167,4173 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | NEXT opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4175,4181 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | PRIOR opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4175,4181 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | PRIOR opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4183,4189 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | FIRST_P opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4183,4189 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | FIRST_P opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4191,4197 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | LAST_P opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4191,4197 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | LAST_P opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4199,4205 ****
n->howMany = -1;
$$ = (Node *)n;
}
! | ABSOLUTE_P SignedIconst opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4199,4205 ----
n->howMany = -1;
$$ = (Node *)n;
}
! | ABSOLUTE_P SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** fetch_args: name
*** 4207,4213 ****
n->howMany = $2;
$$ = (Node *)n;
}
! | RELATIVE_P SignedIconst opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4207,4213 ----
n->howMany = $2;
$$ = (Node *)n;
}
! | RELATIVE_P SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** fetch_args: name
*** 4215,4221 ****
n->howMany = $2;
$$ = (Node *)n;
}
! | SignedIconst opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4215,4221 ----
n->howMany = $2;
$$ = (Node *)n;
}
! | SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4223,4229 ****
n->howMany = $1;
$$ = (Node *)n;
}
! | ALL opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4223,4229 ----
n->howMany = $1;
$$ = (Node *)n;
}
! | ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4231,4237 ****
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
! | FORWARD opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4231,4237 ----
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
! | FORWARD opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4239,4245 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | FORWARD SignedIconst opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4239,4245 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | FORWARD SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** fetch_args: name
*** 4247,4253 ****
n->howMany = $2;
$$ = (Node *)n;
}
! | FORWARD ALL opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4247,4253 ----
n->howMany = $2;
$$ = (Node *)n;
}
! | FORWARD ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** fetch_args: name
*** 4255,4261 ****
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
! | BACKWARD opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
--- 4255,4261 ----
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
! | BACKWARD opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
*************** fetch_args: name
*** 4263,4269 ****
n->howMany = 1;
$$ = (Node *)n;
}
! | BACKWARD SignedIconst opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4263,4269 ----
n->howMany = 1;
$$ = (Node *)n;
}
! | BACKWARD SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** fetch_args: name
*** 4271,4277 ****
n->howMany = $2;
$$ = (Node *)n;
}
! | BACKWARD ALL opt_from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
--- 4271,4277 ----
n->howMany = $2;
$$ = (Node *)n;
}
! | BACKWARD ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
*************** set_target_list:
*** 6941,6947 ****
* CURSOR STATEMENTS
*
*****************************************************************************/
! DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
{
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
n->portalname = $2;
--- 6941,6947 ----
* CURSOR STATEMENTS
*
*****************************************************************************/
! DeclareCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
{
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
n->portalname = $2;
*************** DeclareCursorStmt: DECLARE name cursor_o
*** 6952,6957 ****
--- 6952,6960 ----
}
;
+ cursor_name: name { $$ = $1; }
+ ;
+
cursor_options: /*EMPTY*/ { $$ = 0; }
| cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; }
| cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; }
diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.addons
*** pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:50:37.000000000 +0200
--- pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:51:58.000000000 +0200
*************** ECPG: var_valueNumericOnly addon
*** 211,240 ****
free($1);
$1 = make_str("$0");
}
! ECPG: fetch_argsname addon
add_additional_variables($1, false);
! ECPG: fetch_argsfrom_inname addon
add_additional_variables($2, false);
! ECPG: fetch_argsNEXTopt_from_inname addon
! ECPG: fetch_argsPRIORopt_from_inname addon
! ECPG: fetch_argsFIRST_Popt_from_inname addon
! ECPG: fetch_argsLAST_Popt_from_inname addon
! ECPG: fetch_argsALLopt_from_inname addon
add_additional_variables($3, false);
! ECPG: fetch_argsSignedIconstopt_from_inname addon
add_additional_variables($3, false);
if ($1[0] == '$')
{
free($1);
$1 = make_str("$0");
}
! ECPG: fetch_argsFORWARDALLopt_from_inname addon
! ECPG: fetch_argsBACKWARDALLopt_from_inname addon
add_additional_variables($4, false);
! ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon
! ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon
! ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon
! ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon
add_additional_variables($4, false);
if ($2[0] == '$')
{
--- 211,240 ----
free($1);
$1 = make_str("$0");
}
! ECPG: fetch_argscursor_name addon
add_additional_variables($1, false);
! ECPG: fetch_argsfrom_incursor_name addon
add_additional_variables($2, false);
! ECPG: fetch_argsNEXTopt_from_incursor_name addon
! ECPG: fetch_argsPRIORopt_from_incursor_name addon
! ECPG: fetch_argsFIRST_Popt_from_incursor_name addon
! ECPG: fetch_argsLAST_Popt_from_incursor_name addon
! ECPG: fetch_argsALLopt_from_incursor_name addon
add_additional_variables($3, false);
! ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
add_additional_variables($3, false);
if ($1[0] == '$')
{
free($1);
$1 = make_str("$0");
}
! ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
! ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
add_additional_variables($4, false);
! ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
! ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
! ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
! ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
add_additional_variables($4, false);
if ($2[0] == '$')
{
*************** ECPG: PrepareStmtPREPAREprepared_namepre
*** 255,261 ****
}
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
{ $$ = $2; }
! ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
char *comment;
--- 255,261 ----
}
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
{ $$ = $2; }
! ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
char *comment;
diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.trailer 2009-09-23 19:25:46.000000000 +0200
--- pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 00:55:00.000000000 +0200
*************** prepared_name: name {
*** 285,291 ****
* Declare a prepared cursor. The syntax is different from the standard
* declare statement, so we create a new rule.
*/
! ECPGCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR prepared_name
{
struct cursor *ptr, *this;
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
--- 285,291 ----
* Declare a prepared cursor. The syntax is different from the standard
* declare statement, so we create a new rule.
*/
! ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
{
struct cursor *ptr, *this;
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
*************** ECPGFree: SQL_FREE name { $$ = $2; }
*** 957,963 ****
/*
* open is an open cursor, at the moment this has to be removed
*/
! ECPGOpen: SQL_OPEN name opt_ecpg_using { $$ = $2; };
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }
--- 957,963 ----
/*
* open is an open cursor, at the moment this has to be removed
*/
! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; };
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }