1

I use vims autoformat feature a lot. But it doesn't work properly for postgres

CREATE TABLE foo (fooid INT, foosubid INT, fooname TEXT);
INSERT INTO foo VALUES (1, 2, 'three');
INSERT INTO foo VALUES (4, 5, 'six');

CREATE OR REPLACE FUNCTION getAllFoo() RETURNS SETOF foo AS
$BODY$
DECLARE
r foo%rowtype;
BEGIN
    FOR r IN SELECT * FROM foo
        WHERE fooid > 0
        LOOP
            
            RETURN NEXT r; 
        END LOOP; --should indent here
        RETURN;
    END -- and here
    $BODY$
    LANGUAGE 'plpgsql' ;

The indents don't work properly for loops like this one. Is there a plugin that fixes this? The filetype is recognized as sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.