New answers tagged

1

Faced a similar problem, so I tried the following which worked for me. my schema was something like this, temptable(id serial, events jsonb) and the jsonb array was like this, [{"ts": "t1", "event": "e1", "value": {"search": ["s1"]}}, {"ts": "t2", "event": &...


1

The PRIMARY KEY in the GROUP BY clause explicitly covers the whole row since Postgres 9.1. The release notes: Allow non-GROUP BY columns in the query target list when the primary key is specified in the GROUP BY clause (Peter Eisentraut) The manual: When GROUP BY is present, or any aggregate functions are present, it is not valid for the SELECT list ...


1

To just generate UPDATE statements: CREATE OR REPLACE FUNCTION f_update_all(_old_val text, _new_val text , VARIADIC _tbls regclass[]) RETURNS SETOF text LANGUAGE plpgsql AS $func$ DECLARE _tbl regclass; BEGIN FOREACH _tbl IN ARRAY _tbls LOOP RETURN NEXT 'UPDATE ' || _tbl || ' SET name = $2 WHERE name = ...


2

GROUP BY by primary key column causes each row to become a separate group. In this case the column not included into grouping / aggregating has only one value within the group, so this value may be returned without ambiguity. If there is no primary column / expression as a part of grouping expression then server must consider that there may be more than one ...


0

Here is what I discovered...I hope it helps someone: When supplying the directory arguments to the postgres installer command line, do not encapsulate the paths in double quotes. To succeed with custom paths, ensure there are no spaces in the path names, and therefore no need for the double quotes.


Top 50 recent answers are included