gleu / sqlite_fdw Goto Github PK
View Code? Open in Web Editor NEWForeign Data Wrapper for sqlite
License: Other
Foreign Data Wrapper for sqlite
License: Other
Getting the following build output:
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fpic -I. -I./ -I/home/thom/Development/psql/include/postgresql/server -I/home/thom/Development/psql/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o src/sqlite_fdw.o src/sqlite_fdw.c -MMD -MP -MF .deps/sqlite_fdw.Po
src/sqlite_fdw.c: In function ‘sqliteGetForeignPlan’:
src/sqlite_fdw.c:516:8: error: too few arguments to function ‘make_foreignscan’
NIL); /* no private state either */
^
In file included from src/sqlite_fdw.c:23:0:
/home/thom/Development/psql/include/postgresql/server/optimizer/planmain.h:46:21: note: declared here
extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
^
src/sqlite_fdw.c:518:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [src/sqlite_fdw.o] Error 1
How to execute INSERT,UPDATE,DELETE?
When importing tables with "TEXT(LENGTH)" columns, the following errors occurs:
Error : ERROR: type modifier is not allowed for type "text"
LINE 2: guid text(32) NOT NULL,
^
QUERY: CREATE FOREIGN TABLE public.accounts (
guid text(32) NOT NULL,
name text(2048) NOT NULL,
account_type text(2048) NOT NULL,
commodity_guid text(32),
commodity_scu bigint NOT NULL,
non_std_scu bigint NOT NULL,
parent_guid text(32),
code text(2048),
description text(2048),
hidden bigint,
placeholder bigint
) SERVER sqlite_server
OPTIONS (table 'accounts')
CONTEXT: importing foreign table "accounts"
postgresql version: 9.6.2
Adding the following two lines below line 1487 fixed the error (but I'am very limit to C language and postgresql, so don't know wether it has any negative impact to some other things :-) ).
diff --git a/src/sqlite_fdw.c b/src/sqlite_fdw.c
index 1e0d7bc..30d38cf 100755
--- a/src/sqlite_fdw.c
+++ b/src/sqlite_fdw.c
@@ -1485,6 +1485,8 @@ sqliteTranslateType(StringInfo str, char *typname)
appendStringInfoString(str, "bigint");
/* XXX try harder handling sqlite datatype */
+ else if (strncmp(type, "text", strlen("text")) == 0)
+ appendStringInfoString(str, "text");
/* if original type is compatible, return lowercase value */
else
Thanks for your great work!
Hallo,
the code generated by import foreign schema only generates the headers, not the datatypes.
CREATE FOREIGN TABLE public.vrijetijdextra (
"1" ,
...
"J1_6" )
..
Can anyone confirm this?
I have a sqlite database with blob columns. When I run the following query in sqlite, I'm seeing sizes around 1900
SELECT length(tile_data) from tiles limit 100;
After creating the foreign table, when I execute the corresponding query in postgres, every row is returning 3. Is this a problem with how I created the foreign table or is it a limitation of the sqlite_fdw?
SELECT octet_length(tile_data) from foreign_tiles limit 100;
The create table statement was something like the following (just removed the other column definitions to simplify it)
CREATE FOREIGN TABLE foreign_tiles (
tile_data bytea
) SERVER sqlite_server OPTIONS (table 'tiles')
NOTE: I confirmed that the issue remains even if I use IMPORT FOREIGN SCHEMA to bring the tables in.
Any plans to support Aggregate Pushdown in v10?
Hi,
I can see in Makefile that the logic for running regression tests exists, but the directory test/ is not there. Does that exist elsewhere? Could it be added here, or should I try writing something and submitting a pull request?
I'd be interested in packaging sqlite_fdw for Debian, and having at least some basic smoke test would be nice.
(Also, would you consider creating releases by tagging in Git, so I could track progress better?)
Thanks, Christoph
Hi Guillaume!
Suppose I create a sqlite_fdw for such db:
-- sqlite3 test.db
Create Table test ( id integer Primary Key autoincrement, data blob );
Insert Into test( data ) Values ( X'4869' ); --'4869' is hex encoded 'Hi'
Select id, data From test;
id data
----- ------
1 Hi
Update test Set data = X'480069'; --zero byte between
Select id, data From test; --the same situation will occur in postgres
id data
----- ------
1 H
--in sqlite I can still get whole blob
Select id, hex(data) hex_data, length(data) len From test;
id hex_data len
----- ---------- -----
1 480069 3
How do I get the whole blob in postgres with sqlite_fdw?
As far as I know, a similar situation was with mysql_fdw
I got the following error when I tried to wrap one of my DBs:
ERROR: SQL error during prepare: no such table: sqlite_stat1
After a while I figured out that I had to run ANALYZE on the DB, so sqlite_stat1 is created.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.