oracle / quicksql

A library for generating DDL SQL and entity-relationship-diagrams from Quick SQL code
Universal Permissive License v1.0
53 stars 11 forks source link

/default needs better support for Oracle functions and sequence.nextval #32

Closed dmcghan closed 9 months ago

dmcghan commented 11 months ago

This model:

queues
  queue_id num /pk
  created dt /default systimestamp

Yields this SQL:

create table queues (
    queue_id      number generated by default on null as identity
                  constraint queues_queue_id_pk primary key,
    created_dt    varchar2(4000 char) default on null 'systimestamp'
);

Note that systimestamp is treated as a string, when it should be a function. I see sysdate works fine in the version of QS that ships with APEX 23.2, so some code was added to handle that. However, that seems to be broken on the current version here: https://krisrice.io/quick-sql-standalone.html

An allow list approach will probably not scale anyway, especially considering things like my_owner.my_sequence.nextval.

I recommend adding a new directive (e.g., /defaultraw), which would not wrap the words(s) after it as a string.

vadim-tropashko commented 9 months ago

1.2.1