Project

General

Profile

« Previous | Next » 

Revision 8094

schemas/functions.sql: Added create_if_not_exists()

View differences:

schemas/functions.sql
506 506

  
507 507

  
508 508
--
509
-- Name: create_if_not_exists(text); Type: FUNCTION; Schema: functions; Owner: -
510
--
511

  
512
CREATE FUNCTION create_if_not_exists(sql text) RETURNS void
513
    LANGUAGE plpgsql STRICT
514
    AS $$
515
BEGIN
516
    EXECUTE sql;
517
EXCEPTION
518
    WHEN duplicate_table THEN NULL;
519
END;
520
$$;
521

  
522

  
523
--
524
-- Name: FUNCTION create_if_not_exists(sql text); Type: COMMENT; Schema: functions; Owner: -
525
--
526

  
527
COMMENT ON FUNCTION create_if_not_exists(sql text) IS 'idempotent';
528

  
529

  
530
--
509 531
-- Name: ensure_prefix(text, text); Type: FUNCTION; Schema: functions; Owner: -
510 532
--
511 533

  

Also available in: Unified diff