help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sql-postgres input from create function generates 'sql help' listing


From: hazlup
Subject: sql-postgres input from create function generates 'sql help' listing
Date: Fri, 2 Oct 2009 06:55:34 -0700 (PDT)

This is a bit bizarre but sql-send-paragraph of my function def is generating
a summary of sql commands.

Though the function 'compiles' correctly, each line of the "values" list
apparently generates a call for help!


>From sending this:

 CREATE OR REPLACE FUNCTION update_element_history()
RETURNS "trigger" AS
$BODY$
    DECLARE
        inserthist bool := 'false';
        sts text := OLD.status;
    BEGIN
    /* Apparently staff diddles with locked_by manually and doesn't want to
be held accountable,
       so we look at both to determine a check-in event*/       
    IF NEW.version != OLD.version AND OLD.locked_by IS NOT NULL AND
NEW.locked_by IS NULL THEN
        inserthist := 'true';
        /*check the convertables table for an instance of this element*/
        if conversion_in_progress(new.element_id) then
            new.locked_by := 'conversionprocess';
            raise warning 'would be converting';
        end if;
    END IF;
    IF inserthist THEN
        IF sts IS NULL THEN
            sts := 'unapproved';
        END IF;
        INSERT INTO elements_history(
            element_id,
            version,
            last_modified,
            username,
            comments,
            parent_collection,
            name,
            owner,
            status,
            xml_text
            ) VALUES (
                    quote_literal(OLD.element_id),
                    quote_literal(OLD.version),
                    quote_literal(OLD.last_modified),
                    quote_literal(COALESCE((OLD.last_username), '')),
                    quote_literal(COALESCE(OLD.comments, '')),
                    quote_literal(COALESCE(OLD.parent_collection,'')),
                    quote_literal(COALESCE(OLD.name, '')),
                    quote_literal(COALESCE(OLD.owner, '')),
                    quote_literal(sts),
                    quote_literal(OLD.xml_text)
                    );
    END IF;
    RETURN NULL;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;


I get 10 copies of 
acrestest$# 
ABORT        CHECKPOINT   COMMIT       DECLARE      END          GRANT       
LOCK         REASSIGN     REVOKE       SET          TRUNCATE     VALUES
ALTER        CLOSE        COPY         DELETE FROM  EXECUTE      INSERT      
MOVE         REINDEX      ROLLBACK     SHOW         UNLISTEN     WITH
ANALYZE      CLUSTER      CREATE       DISCARD      EXPLAIN      LISTEN      
NOTIFY       RELEASE      SAVEPOINT    START        UPDATE       
BEGIN        COMMENT      DEALLOCATE   DROP         FETCH        LOAD        
PREPARE      RESET        SELECT       TABLE        VACUUM       

-- 
View this message in context: 
http://www.nabble.com/sql-postgres-input-from-create-function-generates-%27sql-help%27-listing-tp25716253p25716253.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]