Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d61a361

Browse files
committed
Remove all traces of tuplestore_donestoring() in the C code
This routine is a no-op since dd04e95 from 2003, with a macro kept around for compatibility purposes. This has led to the same code patterns being copy-pasted around for no effect, sometimes in confusing ways like in pg_logical_slot_get_changes_guts() from logical.c where the code was actually incorrect. This issue has been discussed on two different threads recently, so rather than living with this legacy, remove any uses of this routine in the C code to simplify things. The compatibility macro is kept to avoid breaking any out-of-core modules that depend on it. Reported-by: Tatsuhito Kasahara, Justin Pryzby Author: Tatsuhito Kasahara Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/CAP0=ZVJeeYfAeRfmzqAF2Lumdiv4S4FewyBnZd4DPTrsSQKJKw@mail.gmail.com
1 parent 4620892 commit d61a361

File tree

24 files changed

+1
-77
lines changed

24 files changed

+1
-77
lines changed

contrib/dblink/dblink.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,6 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
10051005
/* clean up GUC settings, if we changed any */
10061006
restoreLocalGucs(nestlevel);
10071007

1008-
/* clean up and return the tuplestore */
1009-
tuplestore_donestoring(tupstore);
10101008
}
10111009
}
10121010
PG_FINALLY();
@@ -1988,9 +1986,6 @@ dblink_get_notify(PG_FUNCTION_ARGS)
19881986
PQconsumeInput(conn);
19891987
}
19901988

1991-
/* clean up and return the tuplestore */
1992-
tuplestore_donestoring(tupstore);
1993-
19941989
return (Datum) 0;
19951990
}
19961991

contrib/pageinspect/brinfuncs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ brin_page_items(PG_FUNCTION_ARGS)
325325
break;
326326
}
327327

328-
/* clean up and return the tuplestore */
329328
brin_free_desc(bdesc);
330-
tuplestore_donestoring(tupstore);
331329
index_close(indexRel, AccessShareLock);
332330

333331
return (Datum) 0;

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,13 +1803,11 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
18031803
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
18041804
}
18051805

1806-
/* clean up and return the tuplestore */
18071806
LWLockRelease(pgss->lock);
18081807

18091808
if (qbuffer)
18101809
free(qbuffer);
18111810

1812-
tuplestore_donestoring(tupstore);
18131811
}
18141812

18151813
/* Number of output arguments (columns) for pg_stat_statements_info */

contrib/postgres_fdw/connection.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,12 +1508,7 @@ postgres_fdw_get_connections(PG_FUNCTION_ARGS)
15081508

15091509
/* If cache doesn't exist, we return no records */
15101510
if (!ConnectionHash)
1511-
{
1512-
/* clean up and return the tuplestore */
1513-
tuplestore_donestoring(tupstore);
1514-
15151511
PG_RETURN_VOID();
1516-
}
15171512

15181513
hash_seq_init(&scan, ConnectionHash);
15191514
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
@@ -1578,8 +1573,6 @@ postgres_fdw_get_connections(PG_FUNCTION_ARGS)
15781573
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
15791574
}
15801575

1581-
/* clean up and return the tuplestore */
1582-
tuplestore_donestoring(tupstore);
15831576

15841577
PG_RETURN_VOID();
15851578
}

contrib/tablefunc/tablefunc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,6 @@ get_crosstab_tuplestore(char *sql,
943943
/* internal error */
944944
elog(ERROR, "get_crosstab_tuplestore: SPI_finish() failed");
945945

946-
tuplestore_donestoring(tupstore);
947-
948946
return tupstore;
949947
}
950948

contrib/xml2/xpath.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,6 @@ xpath_table(PG_FUNCTION_ARGS)
783783

784784
pg_xml_done(xmlerrcxt, false);
785785

786-
tuplestore_donestoring(tupstore);
787-
788786
SPI_finish();
789787

790788
rsinfo->setResult = tupstore;

src/backend/access/transam/xlogfuncs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ pg_stop_backup_v2(PG_FUNCTION_ARGS)
252252
values[0] = LSNGetDatum(stoppoint);
253253

254254
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
255-
tuplestore_donestoring(tupstore);
256255

257256
return (Datum) 0;
258257
}

src/backend/commands/event_trigger.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,9 +1401,6 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS)
14011401
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
14021402
}
14031403

1404-
/* clean up and return the tuplestore */
1405-
tuplestore_donestoring(tupstore);
1406-
14071404
return (Datum) 0;
14081405
}
14091406

@@ -2061,9 +2058,6 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
20612058
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
20622059
}
20632060

2064-
/* clean up and return the tuplestore */
2065-
tuplestore_donestoring(tupstore);
2066-
20672061
PG_RETURN_VOID();
20682062
}
20692063

src/backend/commands/extension.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,9 +2021,6 @@ pg_available_extensions(PG_FUNCTION_ARGS)
20212021
FreeDir(dir);
20222022
}
20232023

2024-
/* clean up and return the tuplestore */
2025-
tuplestore_donestoring(tupstore);
2026-
20272024
return (Datum) 0;
20282025
}
20292026

@@ -2112,9 +2109,6 @@ pg_available_extension_versions(PG_FUNCTION_ARGS)
21122109
FreeDir(dir);
21132110
}
21142111

2115-
/* clean up and return the tuplestore */
2116-
tuplestore_donestoring(tupstore);
2117-
21182112
return (Datum) 0;
21192113
}
21202114

@@ -2417,9 +2411,6 @@ pg_extension_update_paths(PG_FUNCTION_ARGS)
24172411
}
24182412
}
24192413

2420-
/* clean up and return the tuplestore */
2421-
tuplestore_donestoring(tupstore);
2422-
24232414
return (Datum) 0;
24242415
}
24252416

src/backend/commands/prepare.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,6 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
778778
}
779779
}
780780

781-
/* clean up and return the tuplestore */
782-
tuplestore_donestoring(tupstore);
783-
784781
rsinfo->returnMode = SFRM_Materialize;
785782
rsinfo->setResult = tupstore;
786783
rsinfo->setDesc = tupdesc;

0 commit comments

Comments
 (0)