Note I also tried with SQLDialect.POSTGRES and then I get the double quotes.

But then date values are rendered like:

INSERT INTO "TABLE_A" ("DATE") VALUES ( DATE '2024-03-21')

which I think is not mandatory for PostgreSQL, but is not supported e.g. 
with SQLite...




On Thursday, March 21, 2024 at 4:08:35 PM UTC+1 Marcel Overdijk wrote:

>
>
>         // Create context.
>
>         Settings settings = new Settings()
>                 .withRenderQuotedNames(RenderQuotedNames.ALWAYS);
>
>         DSLContext ctx = DSL.using(SQLDialect.SQLITE, settings);
>
>         // Insert statement.
>
>         Continent continent = new Continent();
>         continent.setId("europe");
>         continent.setCode("eu");
>         continent.setName("Europe");
>         continent.setDemonym("European");
>
>         String insert = ctx
>                 .insertInto(CONTINENT)
>                 .set(ContinentMapper.INSTANCE.unmap(continent))
>                 .getSQL(ParamType.INLINED);
>
>         println(insert);
>
> but this generates:
>
> insert into continent (id, code, name, demonym) values ('europe', 'eu', 
> 'Europe', 'European')
>
> (without quoted identifiers)
>
>
> Note: the schema was generated using DDLDatabase but I assume that should 
> not matter.
>
>
> PS: for SQLite itself is does not matter that much that identifiers are 
> not quoted (although SQLite DOES support this)..
> But in my scenario I'm trying to generate SQL files with inserts that are 
> database independent as possible.
> I e.g. want to double quote the identifiers as I have fields with name 
> year which otherwise cause problems.
> Although MySQL and MariaDB do not support double quotes without SET 
> sql_mode='ANSI_QUOTES'; I could make it work.
> I'm basically looking for a ANSI dialect.
>
> Cheers,
> Marcel
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/f02416bb-2c93-44c8-8492-c036cb059ffcn%40googlegroups.com.

Reply via email to