ALTER TYPE name ADD VALUE [ IF NOT EXISTS ] new_enum_value [ { BEFORE | AFTER } neighbor_enum_value ]
ALTER TYPE name RENAME VALUE existing_enum_value TO new_enum_value
удаляется мало, добавляется пачками ( где то 10 миллионов в день )
не удаляется и не обновляется ничего
update ... where ctid between '(N,1)' and '(N+1000,1)'
update ... where somecolumn between ? and ?
log_line_prefix = '%m %p %u@%d from %h [vxid:%v txid:%x] [%i] '
Этот запрос висит вечно
... DO UPDATE SET payment_date = info.payment_date + interval '23 hours';
The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the table's name (or an alias), and to rows proposed for insertion using the special excluded table.
Current date and time (start of current transaction);
CREATE OR REPLACE FUNCTION example(arg int)
RETURNS int4
LANGUAGE plpgsql
AS $$
declare
out int;
BEGIN
--function body
SELECT field * arg into out FROM randomtable;
return out;
END
$$;
select example(1);
CREATE OR REPLACE FUNCTION example(arg int)
RETURNS int4
LANGUAGE plpgsql
AS $$
declare
out int;
somequery text;
BEGIN
--function body
somequery := $q1$ SELECT field * $1 FROM randomtable $q1$;
EXECUTE somequery into out using arg;
return out;
END
$$;
Могут ли их primary key id смешиватЬся?
То есть, если запросить дату с ORDER BY id, и получить
UPDATE orders_new
SET client_code=access.title
FROM orders_new O
Do not repeat the target table as a from_item unless you intend a self-join (in which case it must appear with an alias in the from_item).