-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix IEEE & bool special values SELECT
, empty as non-text NULL
, add message for datatype error
#57
Conversation
adbc4b3
to
8179f35
Compare
…t for PostgreSQL All character case combinations is valid for special values, eg. NaN, Nan, NAN, nan etc. There is calulating optimisation for mass SELECT.
8179f35
to
71e60a9
Compare
Thank you for creating the pull request.
|
It's still hard for me. I can locate to Line 58 in 3a495b7
Also I have feature request for new readonly option for foreign server and pull request #59.I think all of this options will be near Line 128 in 3a495b7
I propose a names for new options
Good proposition. I am not against. However, treatment of special values is in algorithmic branch of error of value transformation due to datatype difference.
Yes. It's only popular usage examples influenced by PostgreSQL or Oracle conceptions. Especially
Yes, I have made some tests. Results are described in c56c816 Tests. CREATE TABLE bool (
с1 INTEGER,
с2 TEXT
);
CREATE TABLE "Float" ( n real);
CREATE TABLE "Float2" ( n real);
INSERT INTO bool (с1,с2) VALUES (1,'Y');
INSERT INTO bool (с1,с2) VALUES (0,'No');
INSERT INTO bool (с1,с2) VALUES (1,'Yes');
INSERT INTO bool (с1,с2) VALUES (-1,NULL);
INSERT INTO bool (с1,с2) VALUES (2,'true');
INSERT INTO bool (с1,с2) VALUES (1,'false');
INSERT INTO bool (с1,с2) VALUES (10,'ывы');
INSERT INTO bool (с1,с2) VALUES (0,'TRUE');
INSERT INTO bool (с1,с2) VALUES (1,'FALSE');
INSERT INTO "Float" (n) VALUES ('NaN');
INSERT INTO "Float" (n) VALUES (2.4);
INSERT INTO "Float" (n) VALUES (5.0);
INSERT INTO "Float" (n) VALUES (0.0);
INSERT INTO "Float" (n) VALUES ('-infinity');
INSERT INTO "Float" (n) VALUES ('+infinity');
INSERT INTO "Float" (n) VALUES ('-Infinity');
INSERT INTO "Float" (n) VALUES ('+Infinity');
INSERT INTO "Float" (n) VALUES ('nan');
INSERT INTO "Float" (n) VALUES ('naN');
INSERT INTO "Float" (n) VALUES ('-inF');
INSERT INTO "Float" (n) VALUES ('+Inf');
INSERT INTO "Float" (n) VALUES ('+INF'); PostgreSQL CREATE FOREIGN TABLE public."Float" (
n float8 NULL
)
SERVER sqlite_server;
CREATE FOREIGN TABLE public."Float2" (
n float8 NULL
)
SERVER sqlite_server;
SELECT * FROM "bool";
SELECT * FROM "bool" WHERE "с1";
SELECT * FROM "bool" WHERE NOT "с1";
SELECT * FROM "bool" WHERE "с1" IS NULL;
SELECT * FROM "bool" WHERE "с1" IS NOT NULL;
SELECT * FROM "bool" WHERE "с2" IS NULL;
SELECT * FROM "bool" WHERE "с2" IS NOT NULL; is normal queries ( SELECT * FROM "bool" WHERE "с2";
SELECT * FROM "bool" WHERE NOT "с2"; is not normal.
INSERT INTO "Float2" VALUES ('Infinity'::float8);
INSERT INTO "Float" VALUES ('Infinity'::float8); both with no problem for non
During
original in PostgreSQL INSERT INTO public."Float0" (n) VALUES (0.0);
INSERT INTO public."Float0" (n) VALUES (5.0);
INSERT INTO public."Float0" (n) VALUES ('NaN');
INSERT INTO public."Float0" (n) VALUES (1.3333);
INSERT INTO public."Float0" (n) VALUES ('Infinity');
INSERT INTO public."Float0" (n) VALUES ('-Infinity');
INSERT INTO public."Float0" (n) VALUES (NULL);
INSERT INTO "Float2" SELECT * FROM "Float0";
I don't know how exactly it works. I have seen only some SQLs like sqlite_fdw/sql/14.5/extra/float4.sql Line 71 in 3a495b7
|
@t-kataym, this branch was updated. New options of foreign server, foreign table and column for IEEE values and special boolean literals were added. |
SELECT
, empty as non-text NULL
add message for datatype error
First without pushdowning in `WHERE`, only for `SELECT`.
SELECT
, empty as non-text NULL
add message for datatype errorSELECT
, empty as non-text NULL
, add message for datatype error
@mkgrgis I have a concern. The above one is just an example. I think you had better to consider the feasibility and specification carefully before the implementation. |
Yes, @t-kataym, we have a concern just now, regardless of the new options here discussed, with pushdowning something like
Yes. This noticed in Line 406 in 9fd31f4
Yes, we have a hard alternatives here. Must we always thereat any data in PostgreSQL foreign tables as data with SQL2016 behaviour? This sounds tempting, but many querying models to foreign datasource have no SQL2016 behaviour around points we discussed. Where is the distinction between PostgeSQL SQL2016 and SQLite data behaviour in С-language code in our FDW? For many years authors of SQLite provoked non-strict data inserting and we have gigabytes tables with de-facto non-IEEE 754 What is use cases for such alternatives as performance and SQL2016 behaviour?
Yes, but I think the main answer about distinction between PostgreSQL/SQL2016 and SQLite data behaviour inside of FDW C language code may be written by |
@t-kataym, I have made a table about datatype behaviour in |
Non actual because of #71 |
In case of SQLite non-
STRICT
table contains inreal
column valid for PostgreSQL strings withtext
affinity such as case insensitiveNaN
,+Infinity
,+INF
,infinity
,-INF
etc. will be converted to PostgreSQL IEEE special values.Note: there is no special IEEE values in SQlite at all, we just use SQlite as normal input for PostgreSQL
float
-family values regarding to output ofpsql
for this special values.Also added selecting from SQLite
text
-affinity values to PostgreSQLbool
columns like in firebird_fdw realisation.