Revision 8137
Added by Aaron Marcuse-Kubitza almost 12 years ago
schemas/functions.sql | ||
---|---|---|
650 | 650 |
|
651 | 651 |
|
652 | 652 |
-- |
653 |
-- Name: rename_cols(regclass, hstore); Type: FUNCTION; Schema: functions; Owner: - |
|
654 |
-- |
|
655 |
|
|
656 |
CREATE FUNCTION rename_cols(table_ regclass, renames hstore) RETURNS void |
|
657 |
LANGUAGE sql STRICT |
|
658 |
AS $_$ |
|
659 |
SELECT functions.rename_if_exists($$ALTER TABLE $$||$1||$$ RENAME $$ |
|
660 |
||quote_ident(name)||$$ TO $$||quote_ident($2 -> name)) |
|
661 |
FROM functions.col_names($1::text::regtype) f (name) |
|
662 |
$_$; |
|
663 |
|
|
664 |
|
|
665 |
-- |
|
666 |
-- Name: FUNCTION rename_cols(table_ regclass, renames hstore); Type: COMMENT; Schema: functions; Owner: - |
|
667 |
-- |
|
668 |
|
|
669 |
COMMENT ON FUNCTION rename_cols(table_ regclass, renames hstore) IS 'idempotent'; |
|
670 |
|
|
671 |
|
|
672 |
-- |
|
653 | 673 |
-- Name: rename_if_exists(text); Type: FUNCTION; Schema: functions; Owner: - |
654 | 674 |
-- |
655 | 675 |
|
Also available in: Unified diff
schemas/functions.sql: Added rename_cols()