summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad02447)
raw | patch | inline | side by side (parent: ad02447)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 18:36:00 +0000 (19:36 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 18:45:13 +0000 (19:45 +0100) |
The function will now return a set of the names of child tables that have been
created.
created.
contrib/postgresql/collectd_insert.sql | patch | blob | history |
index 7ccd909a7a2feffcee87f7aee580b5ae17fb6340..778de864eed13606e45bda2ab7f0a9b8f8e09944 100644 (file)
-- the tables for the next couple of days
CREATE OR REPLACE FUNCTION values_update_childs(
integer
- ) RETURNS integer
+ ) RETURNS SETOF text
LANGUAGE plpgsql
AS $_$
DECLARE
cur_day date;
next_day date;
i integer;
- n integer;
BEGIN
IF days < 1 THEN
RAISE EXCEPTION 'Cannot have negative number of days';
END IF;
i := 0;
- n := 0;
LOOP
EXIT WHEN i > days;
CONTINUE;
END;
- RAISE INFO 'Created table "values$%"', cur_day;
- n := n + 1;
+ RETURN NEXT 'values$' || cur_day::text;
EXECUTE 'ALTER TABLE ONLY "values$' || cur_day || '"
ADD CONSTRAINT "values_' || cur_day || '_pkey"
ADD CONSTRAINT "values_' || cur_day || '_id_fkey"
FOREIGN KEY (id) REFERENCES identifiers(id)';
END LOOP;
- RETURN n;
+ RETURN;
END;
$_$;