Project

General

Profile

« Previous | Next » 

Revision 14783

bugfix: schemas/util.sql: col_rename(): also need to run util.name_truncate() on the names used in the "don't try to rename to itself" comparison

View differences:

trunk/schemas/util.sql
1507 1507
CREATE FUNCTION col_rename(from_ col, to_name text) RETURNS void
1508 1508
    LANGUAGE sql
1509 1509
    AS $_$
1510
SELECT CASE WHEN to_name != (from_).name THEN -- don't try to rename to itself
1510
SELECT CASE WHEN to_name != from_name THEN -- don't try to rename to itself
1511 1511
util.eval($$ALTER TABLE $$||(from_).table_||$$ RENAME $$
1512
||util.quote_ident((from_).name)||$$ TO $$||util.quote_ident(to_name))
1512
||util.quote_ident(from_name)||$$ TO $$||util.quote_ident(to_name))
1513 1513
END
1514
FROM (SELECT
1515
  util.name_truncate((from_).name) AS from_name
1516
, util.name_truncate(to_name) AS to_name
1517
) s
1514 1518
$_$;
1515 1519

  
1516 1520

  

Also available in: Unified diff