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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try convert #10

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
"contrib/hstore:installcheck",
"contrib/pgcrypto:installcheck",
"contrib/tablefunc:installcheck",
"contrib/try_convert:installcheck",
"contrib/passwordcheck:installcheck",
"contrib/sslinfo:installcheck"]
},
Expand Down
2 changes: 2 additions & 0 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ifeq ($(with_openssl), yes)
$(MAKE) -C contrib/sslinfo all
endif
$(MAKE) -C contrib/tablefunc all
$(MAKE) -C contrib/try_convert all
ifneq ($(with_uuid),no)
$(MAKE) -C contrib/uuid-ossp all
endif
Expand Down Expand Up @@ -96,6 +97,7 @@ ifeq ($(with_openssl), yes)
$(MAKE) -C contrib/sslinfo $@
endif
$(MAKE) -C contrib/tablefunc $@
$(MAKE) -C contrib/try_convert $@
ifneq ($(with_uuid),no)
$(MAKE) -C contrib/uuid-ossp $@
endif
Expand Down
1 change: 1 addition & 0 deletions contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SUBDIRS = \
test_decoding \
test_parser \
test_shm_mq \
try_convert \
tsearch2 \
tablefunc \
unaccent
Expand Down
6 changes: 6 additions & 0 deletions contrib/try_convert/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated subdirectories
/results/
/sql/
/expected/
/input/
/output/
32 changes: 32 additions & 0 deletions contrib/try_convert/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# contrib/try_convert/Makefile

MODULE_big = try_convert
OBJS = try_convert.o $(WIN32RES)

EXTENSION = try_convert
DATA = try_convert--1.0.sql
PGFILEDESC = "try_convert - function for type cast"
REGRESS = try_convert

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/try_convert
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

.PHONY: generate-tests
generate-tests:
mkdir -p input
mkdir -p output
python3 scripts/generate_test.py

all: generate-tests

.PHONY: verify
verify:
python3 scripts/verify.py
40 changes: 40 additions & 0 deletions contrib/try_convert/data/corr_date.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
13:35:45
13:35:90
13:121:45
2323:35:45
13:35:-45
13:-35:45
-13:35:45

12:52:43 AM
15:52:43 AM
12:152:43 AM
12:52:143 AM
12:52:43 PM
15:52:43 PM
12:152:43 PM
12:52:143 PM

21:52:07 JST
21:52:07 MSSSSSK

21:52:07+03:02
21:52:07+33:02
21:52:07-33:02
21:52:07+03:222

1982-06-27 18:52:43
1982-06-32 18:52:43
1982-32-27 18:52:43
99999999999999-06-27 18:52:43

1982-12-12 01:01:59+09:00
1982-12-12 01:01:59+29:00

1982-06-27
1982-06-32
1982-32-27
999999999999999-06-27

11-30-0002 BC
11-30-200000000 BC
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_float4.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_float8.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_int2.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_int4.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_int8.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
18 changes: 18 additions & 0 deletions contrib/try_convert/data/corr_json.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{

[
{"world":"CC", "query":"AA", "line":14, "disabled":false, "date":"CAC", "coauthors":"AB"}
{"world":"CCquery":"AA"}
{,,,,,,}
{"world":"CC",,,,, "query":"AA", "line":14, "disabled":false, "date":"CAC", "coauthors":"AB"}
{"world":"CC", "query"::"AA", "line":14, "disabled":false, "date":"CAC", "coauthors":"AB"}

{"world"}
{"world":"CC", "query":["AA":"BB", "sds"], "line":14, "disabled":false, "date":"CAC", "coauthors":"AB"}
}}}}}}}}
[[[[[[]]]]]]
{[]}
[{}]
][][][][][][]
{}}{}{}}}{{{}{}{}{}}}}
kfgbidsfgadgbdfiugbhdiug
17 changes: 17 additions & 0 deletions contrib/try_convert/data/corr_numeric.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
333333333
333333333333333333333
5555555555555555555555555555555555555555555
dfgdg435fw2342rf445
6.6332342343243242342342342342343243244324
354345345345435345345345345.23467567867325345345
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7
Twenty-two
12234441231.13123123
485728435843759345135.4324234234
4823849249230.f
19203234723472-e102
0000000000000.00000000000000000001
234324+e4443
32 changes: 32 additions & 0 deletions contrib/try_convert/data/corr_time.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
13:35:45
13:35:90
13:121:45
2323:35:45
13:35:-45
13:-35:45
-13:35:45

12:52:43 AM
15:52:43 AM
12:152:43 AM
12:52:143 AM
12:52:43 PM
15:52:43 PM
12:152:43 PM
12:52:143 PM

21:52:07 JST
21:52:07 MSSSSSK

21:52:07+03:02
21:52:07+33:02
21:52:07-33:02
21:52:07+03:222

1982-06-27 18:52:43
1982-06-32 18:52:43
1982-32-27 18:52:43
99999999999999-06-27 18:52:43

1982-12-12 01:01:59+09:00
1982-12-12 01:01:59+19:00
32 changes: 32 additions & 0 deletions contrib/try_convert/data/corr_timestamp.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
13:35:45
13:35:90
13:121:45
2323:35:45
13:35:-45
13:-35:45
-13:35:45

12:52:43 AM
15:52:43 AM
12:152:43 AM
12:52:143 AM
12:52:43 PM
15:52:43 PM
12:152:43 PM
12:52:143 PM

21:52:07 JST
21:52:07 MSSSSSK

21:52:07+03:02
21:52:07+33:02
21:52:07-33:02
21:52:07+03:222

1982-06-27 18:52:43
1982-06-32 18:52:43
1982-32-27 18:52:43
99999999999999-06-27 18:52:43

1982-12-12 01:01:59+09:00
1982-12-12 01:01:59+19:00
32 changes: 32 additions & 0 deletions contrib/try_convert/data/corr_timestamptz.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
13:35:45
13:35:90
13:121:45
2323:35:45
13:35:-45
13:-35:45
-13:35:45

12:52:43 AM
15:52:43 AM
12:152:43 AM
12:52:143 AM
12:52:43 PM
15:52:43 PM
12:152:43 PM
12:52:143 PM

21:52:07 JST
21:52:07 MSSSSSK

21:52:07+03:02
21:52:07+33:02
21:52:07-33:02
21:52:07+03:222

1982-06-27 18:52:43
1982-06-32 18:52:43
1982-32-27 18:52:43
99999999999999-06-27 18:52:43

1982-12-12 01:01:59+09:00
1982-12-12 01:01:59+19:00
32 changes: 32 additions & 0 deletions contrib/try_convert/data/corr_timetz.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
13:35:45
13:35:90
13:121:45
2323:35:45
13:35:-45
13:-35:45
-13:35:45

12:52:43 AM
15:52:43 AM
12:152:43 AM
12:52:143 AM
12:52:43 PM
15:52:43 PM
12:152:43 PM
12:52:143 PM

21:52:07 JST
21:52:07 MSSSSSK

21:52:07+03:02
21:52:07+33:02
21:52:07-33:02
21:52:07+03:222

1982-06-27 18:52:43
1982-06-32 18:52:43
1982-32-27 18:52:43
99999999999999-06-27 18:52:43

1982-12-12 01:01:59+09:00
1982-12-12 01:01:59+19:00
12 changes: 12 additions & 0 deletions contrib/try_convert/data/tt_abstime.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
2015-10-28 16:35:45
1974-02-15 15:52:07
2019-07-22 23:19:33
2024-06-24 23:02:00
1986-12-03 12:16:50
1982-12-11 19:01:59
1979-07-17 08:59:54
1982-06-27 18:52:43
2001-06-25 20:23:38
1975-02-17 19:50:17
2007-06-14 13:50:09
1973-06-11 12:06:52
Loading
Loading