Giter Club home page Giter Club logo

Comments (4)

rhunwicks avatar rhunwicks commented on August 15, 2024

Note that I am running all commands with -n example_schema

from pyrseas.

jmafc avatar jmafc commented on August 15, 2024

It seems adding -n to yamltodb needed a lot more testing. I confirmed that this happens against both 9.1 (which I presume is what you're running) and 8.4.

from pyrseas.

jmafc avatar jmafc commented on August 15, 2024

Actually I'm afraid it was the fix for #21 that caused this new problem. In order not to generate the DROP LANGUAGE and DROP CAST statements in that issue, I removed the languages and casts from the catalogs structures. This happens before from_map is called, which ends up by calling _link_refs and there's where we hit the new problem. I'll have to think more carefully about how to fix this.

In the meantime, it seems that for your purposes, not using -n is a workaround since it creates properly qualified statements:

CREATE LANGUAGE plpgsql;
SET check_function_bodies = false;
CREATE FUNCTION example_schema.aud_dflt() RETURNS trigger
    LANGUAGE plpgsql SECURITY DEFINER
    AS $_$BEGIN
    NEW.modified_by_user = CURRENT_USER;
    NEW.modified_timestamp = CURRENT_TIMESTAMP;
    RETURN NEW;
END $_$;
COMMENT ON FUNCTION example_schema.aud_dflt() IS 'Provides modified_by_user and modified_timestamp values for audit columns.';
ALTER TABLE example_schema.greatgrandparents
    ADD COLUMN modified_by_user character varying(63) NOT NULL;
ALTER TABLE example_schema.greatgrandparents
    ADD COLUMN modified_timestamp timestamp with time zone NOT NULL;
CREATE TRIGGER greatgrandparents_20_aud_dflt
    BEFORE UPDATE ON example_schema.greatgrandparents
    FOR EACH ROW
    EXECUTE PROCEDURE example_schema.aud_dflt();

from pyrseas.

jmafc avatar jmafc commented on August 15, 2024

Further testing revealed the problem is in yamltodb. Here's a fix:

diff --git a/pyrseas/yamltodb.py b/pyrseas/yamltodb.py
index b436704..555d5a6 100755
--- a/pyrseas/yamltodb.py
+++ b/pyrseas/yamltodb.py
@@ -40,7 +40,7 @@ def main(host='localhost', port=5432):
     if args.schlist:
         kschlist = ['schema ' + sch for sch in args.schlist]
         for sch in list(inmap.keys()):
-            if sch not in kschlist:
+            if sch not in kschlist and sch.startswith('schema '):
                 del inmap[sch]
     stmts = db.diff_map(inmap, args.schlist)
     if args.output:

from pyrseas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.