diff --git a/ssql-postgresql.scm b/ssql-postgresql.scm index 7071e5d..5dcf3c5 100644 --- a/ssql-postgresql.scm +++ b/ssql-postgresql.scm @@ -8,7 +8,9 @@ (define *postgresql-translator* (let ((type->sql-converters `((,boolean? . boolean->sql) - ,@(*ansi-translator* 'type->sql-converters)))) + ,@(*ansi-translator* 'type->sql-converters))) + (clauses-order (append (*ansi-translator* 'clauses-order) + '(returning)))) (derive-object (*ansi-translator*) ((escape-string string) @@ -17,6 +19,8 @@ ((boolean->sql boolean) (if boolean "'t'" "'f'")) + ((clauses-order) clauses-order) + ((type->sql-converters) type->sql-converters)))) (define-operators *postgresql-translator* diff --git a/tests/run.scm b/tests/run.scm index 851a9be..85169ec 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -27,6 +27,10 @@ (test "returning" "INSERT INTO widgets VALUES ('foo', 'bar') RETURNING id, name" - (ssql->sql #t '(insert (into widgets) (values ("foo" "bar")) (returning id name))))) + (ssql->sql #t '(insert (into widgets) (values ("foo" "bar")) (returning id name)))) + + (test "compose returning" + '(insert (into widgets) (values (1 2 3)) (returning id)) + (ssql-compose #t '(insert (into widgets) (values (1 2 3))) '((returning id))))) (test-exit) \ No newline at end of file