do not expand records in select list

An expression of the form 'SELECT (func()).*' will be expanded
by Postgresql _before_ execution with the result that the function
will be called as many times as there are fields in the record.
This is not what we want. The function call needs to go into
the FROM clause instead.
This commit is contained in:
Sarah Hoffmann
2022-03-01 08:54:15 +01:00
parent 92bc3cd0a7
commit 15beeef6ce
4 changed files with 14 additions and 10 deletions

View File

@@ -590,7 +590,7 @@ class LegacyICUNameAnalyzer(AbstractAnalyzer):
continue
with self.conn.cursor() as cur:
cur.execute("SELECT (getorcreate_full_word(%s, %s)).*",
cur.execute("SELECT * FROM getorcreate_full_word(%s, %s)",
(token_id, variants))
full, part = cur.fetchone()

View File

@@ -515,7 +515,7 @@ class _TokenInfo:
simple_list = list(set(simple_list))
with conn.cursor() as cur:
cur.execute("SELECT (create_housenumbers(%s)).* ", (simple_list, ))
cur.execute("SELECT * FROM create_housenumbers(%s)", (simple_list, ))
self.data['hnr_tokens'], self.data['hnr'] = cur.fetchone()