2009/11/16 Daniel Quinn <m...@danielquinn.org>

> I may be new to triggers, but I think that I've managed to figure out how
> to
> write one properly with plpgsql and it works even... when I copy/paste the
> SQL
> into psql client window.
>
> However, when I put the aforementioned SQL into a .sql file and run syncdb,
> I
> run into:
>
> Installing custom SQL for nodes.Node model
> Failed to install custom SQL for nodes.Node model: unterminated
> dollar-quoted
> string at or near "$compile_events$
>        BEGIN
>                IF (TG_OP = 'DELETE') THEN
>                        DELETE
>                        FROM
>                                nodes_feed
>                        WHERE
>                                node_id = OLD.node_ptr_id;"
> LINE 3: ...LACE FUNCTION compile_events() RETURNS TRIGGER AS $compile_e...
>
> Now my first option was to run this by my good and dear friend Google, who
> pointed me to this two-year old mailing list message:
>
>  http://www.mail-archive.com/django-users@googlegroups.com/msg20409.html
>
> The solution there though was hacking core...  so I'm hoping that there's
> been
> some development in the past two years.  Anyone care to help me out?
>  Ideally,
> I need the triggers to load after table creation, but before the fixtures
> are
> run.
>
>
Hi,

after banging my head for a few hours, I've found a solution to this problem
with a snippet:

http://www.djangosnippets.org/snippets/1338/

This works for me with the standard SQL syntax (dollar quoting), just put
your custom sql in

your_app/sql/custom.sql

Hope this helps


-- 
Alessandro Pasotti
w3:   www.itopen.it

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to