Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for EXTRACT datetime #40

Closed
cyrille-arundo opened this issue Jan 18, 2021 · 2 comments
Closed

Missing support for EXTRACT datetime #40

cyrille-arundo opened this issue Jan 18, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@cyrille-arundo
Copy link
Contributor

Specification: https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT

馃挃 Your query failed to parse.
This is most likely due to a SQL syntax error. However, you might also have hit a bug, or an unimplemented feature of pg-mem.
If this is the case, please file an issue at https://github.com/oguimbal/pg-mem along with a query that reproduces this syntax error.

馃憠 Failed query:

SELECT EXTRACT(EPOCH FROM TIMESTAMP  '2001-02-16 20:38:40.12-08');

;

馃拃 Syntax error at line 1 col 22:

SELECT EXTRACT(EPOCH FROM
^
Unexpected kw_from token: "from". Instead, I was expecting to see one of the following:

- A "dot" token
- A "dot" token
- A "lparen" token
- A "op_cast" token
- A "lbracket" token
- A "op_member" token
- A "op_membertext" token
- A "op_exp" token
- A "star" token
- A "op_div" token
- A "op_mod" token
- A "op_plus" token
- A "op_minus" token
- A "op_additive" token
- A "kw_not" token
- A "kw_in" token
- A "kw_not" token
- A "op_like" token
- A "op_ilike" token
- A "op_not_like" token
- A "op_not_ilike" token
- A "kw_like" token
- A "kw_ilike" token
- A "kw_not" token
- A "kw_is" token
- A "op_compare" token
- A "kw_notnull" token
- A "kw_is" token
- A "kw_isnull" token
- A "kw_is" token
- A "word" token
- A "op_eq" token
- A "op_neq" token
- A "kw_and" token
- A "kw_or" token
- A "comma" token
- A "rparen" token
- 

See relevant issue at oguimbal/pgsql-ast-parser#5

@oguimbal
Copy link
Owner

oguimbal commented Feb 5, 2021

Hi !

Should be fixed in pg-mem@1.6.2 馃槉

Thanks for the report

@oguimbal oguimbal closed this as completed Feb 5, 2021
@cyrille-arundo
Copy link
Contributor Author

Thank you @oguimbal for the fix.

sambacha pushed a commit to sambacha/pg-mem that referenced this issue Aug 14, 2021
* parser cache

* Build deno

* Fix published types

* Create LICENSE

* Handle extensions + custom functions + a bit of cleaning/refactoring

* Fix current_schema

* Better functions extensibility

* Version bump

* Build deno

* udpate readme

* update readme

* Fix

* Build deno

* fix

* Build deno

* Better errors & constraints handling, valued keywords, fixes.

* Add unit tests + upgrade pgsql-ast-parser

* Fix UTs

* Support drop statements

* Sequence UTs (failing)

* Work on regclass

* Fix & add tests

* Fix regclass

* Fix typeorm

* add some UTs

* bytea + time + restore true casing

* Fix some tests

* fix casing

* Bump

* fix readme

* Build deno

* fix

* Better error reporting

* assimilate oid to int, and support newer versions of typeorm

* Add mirrobytes sample

* db.migrate() from node-sqlite

* add ci

* Update main.yml

* Truncate + on delete XXX behaviour + fixes

* Fixes

* Build deno

* Create codeql-analysis.yml

* tweak

* Fix unhandled rejection warns

* Build deno

* Implement geometric types

* Build deno

* Generated columns + stub support for "match" on foreign keys

oguimbal#9

* support identites on table creation

* Build deno

* Work on custom types

* Work on custom types

* Work on custom types (full typesystem refactoring)

* Fix custom enums uts

* Build deno

* fix timestamp

oguimbal#12

* Fix node-postgres adapter

* Support "overriding" in inserts

oguimbal#15

* Handle distinct

* Support knex.js

oguimbal#13

* Support sequelize

oguimbal#13

* Support values tables

* implement "with" statement

* Support "union" statement

* Fix union

* support "show" & "set" + add pg_range table

* Bump version

* Fix aggregate count on empty selection

* Build deno

* Update readme.md

* Update readme.md

* Update readme.md

* Update readme.md

* Update CONTRIBUTING.md

* Update readme.md

* Update readme.md

* Update readme.md

* public table insert&find + default value fix

* Build deno

* Remove pg-promise hack

vitaly-t/pg-promise#743

* Build deno

* Typo

* Update CONTRIBUTING.md

* Messy commit

* remove sql reconstitution in IValue

* Implement intervals + extract()

oguimbal#40

* Fixes

* Record data type

* Record selection on joins

* Prevent "record" columns

* Add UTs

* Add unit tests

* Update CONTRIBUTING.md

* Support INET type

oguimbal#49

* Support raw arrays statement & fix pg

oguimbal#50

* Support substring & overlay syntaxes

* ignore some unit tests (pending issues) + fixes

* Build deno [autogenerated commit]

* Fix create schema

* Build deno [autogenerated commit]

* Support min/max

* Build deno [autogenerated commit]

* Implement count(distinct) + refactor a bit ordering on jsons

oguimbal/pgsql-ast-parser#12

* Build deno [autogenerated commit]

* Move things & some cleanup

* add some UT to fix

* Support "create functions" & "do" statements with custom compilers.

oguimbal#42

* Build deno [autogenerated commit]

* fix: more sustainable compiler api

* Build deno [autogenerated commit]

* add kind-of-plv8 unit test

* Add files via upload

* Update readme.md

* Fix create unique index

oguimbal#55

* Build deno [autogenerated commit]

* fix UT

oguimbal#55

* fix problems with nil jsonb results

* Support "insert into select" statements

oguimbal#35

* Fix edge cases

* Build deno [autogenerated commit]

* fixed typeorm version

* fix: avoid calling when null arguments (unless accepts explicitely)

* Added SUM and SUM(DISTINCT) aggregators

* formatting

* fix two typos

* Bump version

* Build deno [autogenerated commit]

* fix so undefined => 'null' instead of an error

* bump version

* Build deno [autogenerated commit]

* Fix "create index if not exists"

closes oguimbal#66

* Fix self-referencing tables on creation

closes oguimbal#65

* Fix empty arrays + bump ast-parser

closes oguimbal#64

* Fix build

* Version bump

* Build deno [autogenerated commit]

* Fixed typo in timestamptz support

* Added expression test covering the use of timestamptz

* Bump

* Build deno [autogenerated commit]

* fix: TimestampType.doEquals

The Equality operator must use the absolute value of the difference

oguimbal#71

* Bump

* Build deno [autogenerated commit]

* Use refactored pgsql-ast-parser@6 + fix case-sensitive bugs

* Fix qualified aggregation functions

* registerEquivalentType()

oguimbal#75

* Build deno [autogenerated commit]

* improve readme

* Fix implicit casts on index lookups

oguimbal#69

* Build deno [autogenerated commit]

* Fix typos

* Fix nasty silent discrepancy with pg

# oguimbal#80

* add ut

* Build deno [autogenerated commit]

* Add unit tests (failing)

* Major pgsql-ast-parser version upgrade

* Refactor JOIN a bit

oguimbal/pgsql-ast-parser#30

* Refactor JOIN a bit

oguimbal/pgsql-ast-parser#30

* fix

* add ut

* Fixes + json null implementation leak

* Build deno [autogenerated commit]

* location tracking

* Fix leaky implementation details

oguimbal#84

* Build deno [autogenerated commit]

* Fix "SHOW" statement

oguimbal#88

* Build deno [autogenerated commit]

* Implement views

oguimbal#34

* bump version

* Build deno [autogenerated commit]

* Update package.json

* Views column names mapping

oguimbal#34

* add possible deps as optional peer dependencies

* Query interceptions

* Small fixes

* Support Mikro-orm

oguimbal#95

* Build deno [autogenerated commit]

* fix

* Build deno [autogenerated commit]

* Support at least independent inner requests (bugfix)

* Build deno [autogenerated commit]

* (regression) Fix select  "someAlias".*  on filtered statements

oguimbal#97

* Build deno [autogenerated commit]

* Fix drop column

oguimbal#96

* Build deno [autogenerated commit]

* Expose ISchema.getType() & IType.asArray()

oguimbal#99

* Build deno [autogenerated commit]

* Support schema definition with raw data type

oguimbal#99 (reply in thread)

* Build deno [autogenerated commit]

* Introduce the column manager for tables

Also remove columnDefs, which is replaceable with the columnManager

* fix type error + indentation

* update(adapters): add support to pass knexConfig

* tests: add test to validate knex config

* update: remove knex types to avoid bad DX

* bump

* Build deno [autogenerated commit]

* docs: fix contribuiting typo links

* docs: ajust link to ast-parser

* Add array_agg support

* Bump version

* Build deno [autogenerated commit]

* Add support of an avg function

* Also flag serial (autoincrement) when the type is bigserial

* Add test

* bump

* Build deno [autogenerated commit]

* feature/overlapOperator

* Fix some binary operator stuff

* Fix group-by on empty sets oguimbal#121

* Produce a PG unique_violation error

* fixes oguimbal#135, allowing insert empty arrays

* Bump version

* Build deno [autogenerated commit]

* fix release script

* Important quickfix OR/AND binary operator & null values oguimbal#138

* Build deno [autogenerated commit]

* fixes oguimbal#137, does not leak symbols in rows in pg adapter

* Version bump

* Build deno [autogenerated commit]

* Remove debugger

* Fix  oguimbal#146

* Build deno [autogenerated commit]

Co-authored-by: oguimbal <olivier.guimbal@gadz.org>
Co-authored-by: Olivier Guimbal <oguimbal@users.noreply.github.com>
Co-authored-by: Andrey Filatkin <anfilat@mail.ru>
Co-authored-by: maxvandongen <maxvandongen@yahoo.com>
Co-authored-by: Brahm Lower <bplower@gmail.com>
Co-authored-by: Cyrille Verrier <cyrille.verrier.external@arundo.com>
Co-authored-by: Karl Horky <karl.horky@gmail.com>
Co-authored-by: Vincent Lecrubier <vincent.lecrubier@gmail.com>
Co-authored-by: Florent FAYOLLE <florent.fayolle@stormshield.eu>
Co-authored-by: RafaelGSS <rafael.nunu@hotmail.com>
Co-authored-by: Ivan Matvieiev <ivan.matvieiev@bringg.com>
Co-authored-by: Jon Williams <jon@jonathannen.com>
Co-authored-by: bramkaashoek <bramkaashoek@gmail.com>
Co-authored-by: Clemens Zeidler <clemens.zeidler@smartparking.com>
Co-authored-by: Gabriel VIVAS <gabriel.vivas@stormshield.eu>
SD11892 added a commit to SD11892/pg-mem that referenced this issue Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants