Fix column names quoting in reset-all-sequences.

The other user-provided names (schema and table) were already quoted
using the quote_ident() PostgreSQL functio, but the column name (attname
in the catalogs) were not.

Blind attempt to fix #425.
This commit is contained in:
Dimitri Fontaine 2016-06-20 20:05:06 +02:00
parent 3109ba14dc
commit 7daee9405f

View File

@ -485,7 +485,7 @@ BEGIN
|| trim(trailing ')'
from replace(pg_get_expr(d.adbin, d.adrelid),
'nextval', 'setval'))
|| ', (select greatest(max(' || a.attname || '), 1) from only '
|| ', (select greatest(max(' || quote_ident(a.attname) || '), 1) from only '
|| quote_ident(nspname) || '.' || quote_ident(relname) || '));' as sql
FROM pg_class c
JOIN pg_namespace n on n.oid = c.relnamespace