SpatialDB Advisor
|
Current PostGIS Blog Articles • Gridding a geometry object (PostGIS) • ST_Parallel for PostGIS • FOSSLIC - PostGIS presentations • Vectorization: Exploding a linestring or polygon into individual vectors in PostGIS • How to apply spatial constraints to PostGIS tables • Loading and Processing GPX 1.1 files using PostgreSQL XML • Converting Oracle Optimized Rectangles to PostGIS • Building polygons from overlapping linestrings requiring intersection • Loading Point Data from a CSV File in PostGIS • DMS2DD for PostGIS • Implementing Oracle's GetVertices function in PostGIS - ST_DumpPoints • Filtering Rings in Polygon (PostGIS)
|
I recently wrote an article on the use of External File with Oracle tables to load point data into Oracle. I thought I would have a look on how to do this in PostGIS. A bit of research came up with the PostgreSQL COPY SQL command. There appears to be no equivalent to Oracle’s Organisation External for a table. In PostgreSQL you simply create your table and then insert data into it from an external file. You don’t seem to need to concern yourself with special permissions to do this: just get in and do it. Which is what we will do right now.
Now, that was pretty simple. There are certainly advantages to the PostgreSQL way of loading CSV organised data. I am not sure about the lack of security with regards to external file access though. One thing in Oracle’s favour is that externally organised tables can be used without having to load the data which can be useful in many situations. Anyway, I hope this article is of use to someone. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]()
![]() |
Comment [2]
I haven’t played with copy much but this is what I recall. I’ll have to verify my assumptions.
I wouldn’t say there is a lack of security for PostgreSQL, but it is probably not as fine grained as Oracle.
1) As I recall, you can only copy from directories where the service account PostgreSQL is running under has rights to the folder. Since PostgreSQL should never run as root and even refuses to run under Administrator in windows — this is not so much of an issue.
It just so happens that the C:\Temp folder has security set to everyone.
2) Also have to verify, but I think only super admins in Postgres can use the copy command. I should know this, but I’m not sure if you can even assign copy rights to non-super users. So if you wanted to copy under another account, you would have to create a stored function that does the copy and set it to run as SECURITY DEFINER. Then it would run under the context of the owner of the stored function and if that stored function is owned by a super user then it would work.
— Regina · 22 February 2009, 16:34 · #
Thanks a lot for that, it did help me a lot!
— Johannes · 5 December 2009, 01:19 · #