Project

General

Profile

« Previous | Next » 

Revision 10145

schemas/util.sql: added set_col_names_with_metadata()

View differences:

schemas/util.sql
1226 1226

  
1227 1227

  
1228 1228
--
1229
-- Name: set_col_names_with_metadata(regclass, regclass); Type: FUNCTION; Schema: util; Owner: -
1230
--
1231

  
1232
CREATE FUNCTION set_col_names_with_metadata(table_ regclass, names regclass) RETURNS void
1233
    LANGUAGE plpgsql STRICT
1234
    AS $_$
1235
DECLARE
1236
	row_ util.map;
1237
BEGIN
1238
	FOR row_ IN
1239
		EXECUTE $$DELETE FROM $$||names||$$ WHERE "from" LIKE ':%' RETURNING *$$
1240
	LOOP
1241
		PERFORM mk_const_col((table_, "to"), substring("from" from 1));
1242
	END LOOP;
1243
	
1244
	PERFORM util.set_col_names(table_, names);
1245
END;
1246
$_$;
1247

  
1248

  
1249
--
1250
-- Name: FUNCTION set_col_names_with_metadata(table_ regclass, names regclass); Type: COMMENT; Schema: util; Owner: -
1251
--
1252

  
1253
COMMENT ON FUNCTION set_col_names_with_metadata(table_ regclass, names regclass) IS 'idempotent.
1254
deletes metadata mappings from names table.';
1255

  
1256

  
1257
--
1229 1258
-- Name: set_col_types(regclass, col_cast[]); Type: FUNCTION; Schema: util; Owner: -
1230 1259
--
1231 1260

  

Also available in: Unified diff