Skip to content

Instantly share code, notes, and snippets.

@pramsey
Last active April 22, 2016 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pramsey/35fedc493b4bb8e45a2faa532c7cdc6e to your computer and use it in GitHub Desktop.
Save pramsey/35fedc493b4bb8e45a2faa532c7cdc6e to your computer and use it in GitHub Desktop.
Updateable OGR FDW
Butterfly:~/Code/pgsql-ogr-fdw pramsey(readwrite)$ cat data/pt_two.dbf
Peter 45 5.6019650412 Paul 33 5.8419710325
Butterfly:~/Code/pgsql-ogr-fdw pramsey(readwrite)$ psql fdw
psql (9.5.1)
Type "help" for help.
fdw=# select * from pt_1 ;
fid | geom | name | age | height | birthdate
-----+--------------------------------------------+-------+-----+--------+------------
0 | 0101000000C00497D1162CB93F8CBAEF08A080E63F | Peter | 45 | 5.6 | 1965-04-12
1 | 010100000054E943ACD697E2BFC0895EE54A46CF3F | Paul | 33 | 5.84 | 1971-03-25
(2 rows)
fdw=# update pt_1 set name = 'PAT' where fid = 1;
NOTICE: ogrAddForeignUpdateTargets
NOTICE: ogrIsForeignRelUpdatable
NOTICE: ogrBeginForeignModify
NOTICE: ogrExecForeignUpdate
NOTICE: ogrEndForeignModify
UPDATE 1
fdw=# select * from pt_1 ;
fid | geom | name | age | height | birthdate
-----+--------------------------------------------+-------+-----+--------+------------
0 | 0101000000C00497D1162CB93F8CBAEF08A080E63F | Peter | 45 | 5.6 | 1965-04-12
1 | 010100000054E943ACD697E2BFC0895EE54A46CF3F | PAT | 33 | 5.84 | 1971-03-25
(2 rows)
fdw=# \q
Butterfly:~/Code/pgsql-ogr-fdw pramsey(readwrite)$ cat data/pt_two.dbf
Peter 45 5.6019650412 PAT 33 5.8419710325
@pramsey
Copy link
Author

pramsey commented Apr 22, 2016

Unfortunately handling deletion means going back and revisiting this whole book of work from first principles again. More to learn about PgSQL FDW still...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment