SCM

[#1011291] Errors applying changes to tables with reserved keywords as column names

View Trackers | Bugs | Download .csv | Monitor

Date:
2012-12-17 19:05
Priority:
3
State:
Open
Submitted by:
Ben C. (bench)
Assigned to:
Nobody (None)
Category:
None
Group:
None
Resolution:
None
 
Summary:
Errors applying changes to tables with reserved keywords as column names

Detailed description
We have a table with a column named "from". pg_reorg is unhappy when applying changes that happened while working on this table. The solution seems to be to add a quote_ident() call around the first attname in get_assign, like so:

CREATE FUNCTION reorg.get_assign(oid, text) RETURNS text AS
$$
SELECT '(' || array_to_string(reorg.array_accum(quote_ident(attname)), ', ') ||
') = (' || $2 || '.' ||
array_to_string(reorg.array_accum(quote_ident(attname)), ', ' || $2 || '.') || ')'
FROM (SELECT attname FROM pg_attribute
WHERE attrelid = $1 AND attnum > 0 AND NOT attisdropped
ORDER BY attnum) tmp;
$$
LANGUAGE sql STABLE STRICT;


I'm not sure why that quote_ident() was missing.

Followup

No Followups Have Been Posted

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge