Skip to content

Commit 367b3df

Browse files
committed
Rewrite update_functions.sql to avoid dependency on internal logic of the
optimizer which can vary on version of PG core.
1 parent 501e8c6 commit 367b3df

File tree

2 files changed

+22
-72
lines changed

2 files changed

+22
-72
lines changed

expected/update_functions.out

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -295,40 +295,10 @@ UNION ALL
295295
-- aqo_data_update() testing.
296296
--
297297
-- Populate aqo_data with dump data.
298-
SELECT aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS res
299-
FROM aqo_data_dump
300-
ORDER BY res;
301-
res
302-
-----
303-
t
304-
t
305-
t
306-
t
307-
t
308-
t
309-
t
310-
t
311-
t
312-
t
313-
t
314-
t
315-
t
316-
t
317-
t
318-
t
319-
t
320-
t
321-
t
322-
t
323-
t
324-
t
325-
t
326-
t
327-
t
328-
t
329-
t
330-
(27 rows)
331-
298+
SELECT count(*) AS res1 FROM
299+
aqo_data_dump,
300+
LATERAL aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS ret
301+
WHERE ret \gset
332302
-- Check if data is the same as in source, no result rows expected.
333303
(TABLE aqo_data_dump EXCEPT TABLE aqo_data)
334304
UNION ALL
@@ -338,39 +308,15 @@ UNION ALL
338308
(0 rows)
339309

340310
-- Update aqo_data with dump data.
341-
SELECT aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS res
342-
FROM aqo_data_dump
343-
ORDER BY res;
344-
res
345-
-----
346-
t
347-
t
348-
t
349-
t
350-
t
351-
t
352-
t
353-
t
354-
t
355-
t
356-
t
357-
t
311+
SELECT count(*) AS res2 FROM
312+
aqo_data_dump,
313+
LATERAL aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS ret
314+
WHERE ret \gset
315+
SELECT :res1 = :res2 AS ml_sizes_are_equal;
316+
ml_sizes_are_equal
317+
--------------------
358318
t
359-
t
360-
t
361-
t
362-
t
363-
t
364-
t
365-
t
366-
t
367-
t
368-
t
369-
t
370-
t
371-
t
372-
t
373-
(27 rows)
319+
(1 row)
374320

375321
-- Check if data is the same as in source, no result rows expected.
376322
(TABLE aqo_data_dump EXCEPT TABLE aqo_data)

sql/update_functions.sql

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,23 @@ UNION ALL
146146
--
147147

148148
-- Populate aqo_data with dump data.
149-
SELECT aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS res
150-
FROM aqo_data_dump
151-
ORDER BY res;
149+
SELECT count(*) AS res1 FROM
150+
aqo_data_dump,
151+
LATERAL aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS ret
152+
WHERE ret \gset
152153

153154
-- Check if data is the same as in source, no result rows expected.
154155
(TABLE aqo_data_dump EXCEPT TABLE aqo_data)
155156
UNION ALL
156157
(TABLE aqo_data EXCEPT TABLE aqo_data_dump);
157158

158159
-- Update aqo_data with dump data.
159-
SELECT aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS res
160-
FROM aqo_data_dump
161-
ORDER BY res;
160+
SELECT count(*) AS res2 FROM
161+
aqo_data_dump,
162+
LATERAL aqo_data_update(fs, fss, nfeatures, features, targets, reliability, oids) AS ret
163+
WHERE ret \gset
164+
165+
SELECT :res1 = :res2 AS ml_sizes_are_equal;
162166

163167
-- Check if data is the same as in source, no result rows expected.
164168
(TABLE aqo_data_dump EXCEPT TABLE aqo_data)

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