sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Support for special syntaxes for example in SQL_MODE='ORACLE'

Open calebdw opened this issue 2 years ago • 3 comments

Hello!

I know this library is primarily for MySQL dialects, but this is the only PHP SQL parser I could find...

This can't parse the 'custom' Postgres dump, but I found it can sort of parser the plain text format with varying results.

The parser seems to stop after the first timestamp column (it parsed created_at) so I have a bunch of table create statements with only two columns:

CREATE TABLE public.urls (
    id integer NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone,
    long_url text NOT NULL
);

Any ideas why?

Thanks!

calebdw avatar Mar 04 '23 20:03 calebdw

Hi! That's interesting, probably out of the scope of the parser unless MariaDB has a postgres sql compatibility mode?

Tehy already do have compatibility for sql server things or supports the without time zone? Can you research this a bit more before we investigate?

williamdes avatar Mar 04 '23 20:03 williamdes

@williamdes, thanks for the response. I ended up implementing a solution that didn't involve parsing Postgres dumps.

I understand if this is out-of-scope and you'd like to close the issue, just figured I raise it in case others experienced the same thing. I dug around a bit but unfortunately this is a little over my head

calebdw avatar Mar 06 '23 18:03 calebdw

I understand if this is out-of-scope and you'd like to close the issue, just figured I raise it in case others experienced the same thing. I dug around a bit but unfortunately this is a little over my head

Thank you for reporting ;)

Let's keep this one open so we can check about SET SQL_MODE='ORACLE';: https://mariadb.com/kb/en/sql_modeoracle/

Especially about :param1 query placeholders

See: #202

williamdes avatar Mar 09 '23 19:03 williamdes