1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Split array_push into separate array_append and array_prepend functions.

There wasn't any good reason for a single C function to implement both
these SQL functions: it saved very little code overall, and it required
significant pushups to re-determine at runtime which case applied.  Redoing
it as two functions ends up with just slightly more lines of code, but it's
simpler to understand, and faster too because we need not repeat syscache
lookups on every call.

An important side benefit is that this eliminates the only case in which
different aliases of the same C function had both anyarray and anyelement
arguments at the same position, which would almost always be a mistake.
The opr_sanity regression test will now notice such mistakes since there's
no longer a valid case where it happens.
This commit is contained in:
Tom Lane
2015-02-18 20:53:14 -05:00
parent d30292b8c4
commit 56a79a869b
5 changed files with 135 additions and 112 deletions

View File

@ -176,8 +176,7 @@ ORDER BY 1, 2;
25 | 1043
1114 | 1184
1560 | 1562
2277 | 2283
(5 rows)
(4 rows)
SELECT DISTINCT p1.proargtypes[1], p2.proargtypes[1]
FROM pg_proc AS p1, pg_proc AS p2
@ -194,8 +193,7 @@ ORDER BY 1, 2;
23 | 28
1114 | 1184
1560 | 1562
2277 | 2283
(4 rows)
(3 rows)
SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2]
FROM pg_proc AS p1, pg_proc AS p2