Code Monkey home page Code Monkey logo

timestamp9's People

Contributors

fvannee avatar higuoxing avatar liuxueyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

timestamp9's Issues

Add support for Timestamp9 data type without time zone information

Hi, @fvannee

Currently, timestamp9 only recognize timestamp with time zone information 'y-m-d h:m:s.ns +tz', while Postgres supports both timestamp and timestamptz data types. What about making the current timestamp9 data type to timestamp9tz and introduce a new data type timestamp9 (timestamp9 without time zone information)? What do you think of it? I think I can help implement it.

Getting current timestamp with nanosecond precision

Hi Floris, this codebase should really get extended with the ability to do something similar to:

SELECT CURRENT_TIMESTAMP;

..., (i.e., get the time now with nanosecond precision, which I realize is OS specific). If you would like, I can implement this for Windows/Linux and submit a pull-request, but I may have questions for you along the way.

Validate timestamp value when doing conversions.

We should validate timestamp values when doing conversions. E.g.,

=# select '2362-04-01'::timestamp::timestamp9;
             timestamp9
-------------------------------------
 1777-09-10 00:31:09.290448384 +0805
(1 row)

I will propose PR to fix this issue.

There is no check for timestamp range boundaries.

select '2262-04-11 23:47:16.854775807 +0000'::timestamp9;

returns: 2262-04-11 23:47:16.854775807 +0000

select '2262-04-11 23:47:16.854775808 +0000'::timestamp9;

returns: 1677-09-21 00:12:43.145224192 +0000

PostgreSQL 16 support

Hi,

PostgreSQL 16 Beta 1 is out. 1.3.0 fails to compile against it. What are the plans for v16 support?

Regards, Devrim

[ 66%] Built target sqlfile
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c: In function 'parse_sane_timezone':
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:237:63: warning: passing argument 4 of 'DecodeTimezoneAbbrev' from incompatible pointer type [-Wincompatible-pointer-types]
  237 |                 type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
      |                                                               ^~~~
      |                                                               |
      |                                                               pg_tz **
In file included from /build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:15:
/usr/pgsql-16/include/server/utils/datetime.h:343:83: note: expected 'int *' but argument is of type 'pg_tz **'
  343 |                                                                  int *ftype, int *offset, pg_tz **tz,
      |                                                                              ~~~~~^~~~~~
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:237:24: error: too few arguments to function 'DecodeTimezoneAbbrev'
  237 |                 type = DecodeTimezoneAbbrev(0, lowzone, &val, &tzp);
      |                        ^~~~~~~~~~~~~~~~~~~~
/usr/pgsql-16/include/server/utils/datetime.h:342:17: note: declared here
  342 | extern int      DecodeTimezoneAbbrev(int field, const char *lowtoken,
      |                 ^~~~~~~~~~~~~~~~~~~~
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c: In function 'timestamp9_in':
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:311:17: error: too few arguments to function 'DecodeDateTime'
  311 |                 DecodeDateTime(field, ftype, nf, &dtype, p_tm, &fsec, &tz) != 0)
      |                 ^~~~~~~~~~~~~~
/usr/pgsql-16/include/server/utils/datetime.h:312:17: note: declared here
  312 | extern int      DecodeDateTime(char **field, int *ftype, int nf,
      |                 ^~~~~~~~~~~~~~
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:315:27: warning: declaration of 'ns' shadows a previous local [-Wshadow=compatible-local]
  315 |                 long long ns;
      |                           ^~
/build/pgrpms/rpm/redhat/main/non-common/timestamp9/main/timestamp9-timestamp9-1.3.0/src/timestamp9.c:287:19: note: shadowed declaration is here
  287 |         long long ns;
      |                   ^~
make[3]: *** [src/CMakeFiles/timestamp9.dir/build.make:76: src/CMakeFiles/timestamp9.dir/timestamp9.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:183: src/CMakeFiles/timestamp9.dir/all] Error 2
make[1]: *** [Makefile:156: all] Error 2

Create as a PostgreSQL extension

Great project, thanks! It would be great to get this added as a pistgres extension or part of postgres main. This is very useful for time duration in nanoseconds so as to maintain the precision of int64 nanoseconds. Any thoughts of doing this?

Subsecond timestamps without timezone are not accepted

Subsecond timestamps without timezone are not accepted. select '2019-09-19 08:30:05.123456789'::timestamp9; gives an error:

ERROR:  invalid input format for timestamp9, required format y-m-d h:m:s.ns +tz "2019-09-19 08:30:05.123456789"
LINE 11: select '2019-09-19 08:30:05.123456789'::timestamp9;
                ^
SQL state: 22008
Character: 244

Both timestamp and timestamptz can parse the same string: select '2019-09-19 08:30:05.123456789'::timestamp; => 2019-09-19 08:30:05.123457.

"infinity" and "-infinity" support

The request

select 'infinity'::timestamp9;

or

select '-infinity'::timestamp9;

throws an error: [22008] ERROR: invalid input format for timestamp9, required format y-m-d h:m:s.ns [+tz]

-- Configuring incomplete, errors occurred!

Do i need to manually provide targets, i encountered following error

CMake Error at src/CMakeLists.txt:79 (install):
install TARGETS given no LIBRARY DESTINATION for module target
"timestamp9".

CMake Error at CMakeLists.txt:197 (get_parents):
get_parents Macro invoked with incorrect arguments for macro named:
get_parents

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.