[postgis-users] shp2pgsql not loading in 0.8.2
Seamus Thomas Carroll
carrolls at cpsc.ucalgary.ca
Fri Jan 30 14:08:23 PST 2004
I never use double quotes so I took a guess on the proper use of double
quotes. A search for \"%s.%s\" and replace with \"%s\".\"%s\" should
resolve the problem below fairly quickly. Either way I am happy with the
way importing works now.
Seamus
On Fri, 30 Jan 2004, strk wrote:
> Just a quick look:
> -- printf("\nInsert into \"%s.%s\" %s
> Cannot be right, since MySchema.MyTable should be written
> "MySchema"."MyTable" and not "MySchema.MyTable" which would be
> interpreted as the name of a single table.
>
> Moreover we don't want to miss support for pre-schema installations,
> so schema usage should be activated only when provided.
>
> .. I still think the best way is just setting the searc_path before
> sourcing the output of shp2pgsql for now ...
>
> --strk;
>
> carrolls wrote:
> > Hi,
> >
> > I ran the diff between my shp2pgsql and the previous shp2pgsql (from cvs).
> > I think i have tested most everything in my personal use except the -D
> > option.
> >
> > Seamus
> >
> > On Thu, 29 Jan 2004, strk wrote:
> >
> > > carrolls wrote:
> > > > Hi strk,
> > > >
> > > > Sorry for the late response. I edited shp2pgsql.c to take a schema
> > > > arguement and made the needed changes to accomadate the schema arguement.
> > > >
> > > > So I guess the answer to your question is yes. Thanks for making
> > > > Add/DropGeometryColumn handle schemas.
> > >
> > > Would you share your changes in shp2pgsql.c ?
> > > I did not continue with it because stuck with the amount of if/then
> > > blocks reached with identifiers quoting, schema support and similar...
> > >
> > > I was reasoning about re-organizing most of the code but haven't find
> > > the time yet. I was thinking about reducing the lines printing the
> > > insert part :)
> > >
> > > --strk;
> > >
> > >
> > > >
> > > > Seamus
> > > >
> > > > On Sat, 17 Jan 2004, strk wrote:
> > > >
> > > > > carrolls wrote:
> > > > > > Looks good,
> > > > > >
> > > > > > I have tried importing in the table and I think it now works without
> > > > > > error.
> > > > >
> > > > > Did you get to create the geotable in the schema of your choice ?
> > > > > --strk;
> > > > >
> > > > > _______________________________________________
> > > > > postgis-users mailing list
> > > > > postgis-users at postgis.refractions.net
> > > > > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > > > >
> > > >
> > > > _______________________________________________
> > > > postgis-users mailing list
> > > > postgis-users at postgis.refractions.net
> > > > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > > _______________________________________________
> > > postgis-users mailing list
> > > postgis-users at postgis.refractions.net
> > > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > >
>
> Content-Description: diff file
> > 132c132
> > < int ring_check(SHPObject* obj, char *schema, char *table, char *sr_id, int rings,
> > ---
> > > int ring_check(SHPObject* obj, char *table, char *sr_id, int rings,
> > 282c282
> > < int ring_check(SHPObject* obj, char *schema, char *table, char *sr_id, int rings,DBFHandle hDBFHandle){
> > ---
> > > int ring_check(SHPObject* obj, char *table, char *sr_id, int rings,DBFHandle hDBFHandle){
> > 428c428
> > < printf("\nInsert into \"%s.%s\" %s values(",schema,table,col_names);
> > ---
> > > printf("\nInsert into \"%s\" %s values(",table,col_names);
> > 430c430
> > < printf("\nInsert into \"%s.%s\" %s values('%i',",schema,table,col_names,rings);
> > ---
> > > printf("\nInsert into \"%s\" %s values('%i',",table,col_names,rings);
> > 434c434
> > < printf("\nInsert into %s.%s %s values(",schema,table,col_names);
> > ---
> > > printf("\nInsert into %s %s values(",table,col_names);
> > 436c436
> > < printf("\nInsert into %s.%s %s values('%i',",schema,table,col_names,rings);
> > ---
> > > printf("\nInsert into %s %s values('%i',",table,col_names,rings);
> > 596c596
> > < char *sr_id,*shp_file,*schema = "public",*table;
> > ---
> > > char *sr_id,*shp_file,*table;
> > 649c649
> > < for ( ; optind < ARGC; optind++){
> > ---
> > > for ( ; optind < ARGC; optind++){
> > 652c652
> > < }else if( curindex == 1 ){
> > ---
> > > }else if(curindex == 1){
> > 654,655d653
> > < }else if(curindex == 2){
> > < schema = ARGV[optind];
> > 671c669
> > < printf("USAGE: shp2pgsql [<options>] <shapefile name> <table name> [<schema name>]\n");
> > ---
> > > printf("USAGE: shp2pgsql [<options>] <shapefile name> <table name>\n");
> > 688d685
> > < printf("\n<schema> defaults to public.\n");
> > 704c701
> > < printf("select DropGeometryColumn('%s','%s','the_geom');", schema, table);
> > ---
> > > printf("select DropGeometryColumn('','%s','the_geom');", table);
> > 706c703
> > < printf("\ndrop table \"%s.%s\";\n",schema,table);
> > ---
> > > printf("\ndrop table \"%s\";\n",table);
> > 708c705
> > < printf("\ndrop table %s.%s;\n",schema,table);
> > ---
> > > printf("\ndrop table %s;\n",table);
> > 780c777
> > < printf("CREATE TABLE \"%s.%s\" (gid serial", schema, table);
> > ---
> > > printf("CREATE TABLE \"%s\" (gid serial", table);
> > 782c779
> > < printf("CREATE TABLE %s.%s (gid serial", schema, table);
> > ---
> > > printf("CREATE TABLE %s (gid serial", table);
> > 850c847
> > < printf("select AddGeometryColumn('%s','%s','the_geom','%s',",schema,table,sr_id);
> > ---
> > > printf("select AddGeometryColumn('','%s','the_geom','%s',",table,sr_id);
> > 880c877
> > < printf("COPY \"%s.%s\" %s FROM stdin;\n",schema,table, col_names);
> > ---
> > > printf("COPY \"%s\" %s FROM stdin;\n",table, col_names);
> > 935c932
> > < tot_rings = ring_check(obj,schema,table,sr_id,tot_rings,hDBFHandle);
> > ---
> > > tot_rings = ring_check(obj,table,sr_id,tot_rings,hDBFHandle);
> > 972c969
> > < printf("insert into \"%s.%s\" %s values (",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values (",table,col_names);
> > 974c971
> > < printf("insert into \"%s.%s\" %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values ('%i',",table,col_names,j);
> > 978c975
> > < printf("insert into %s.%s %s values (",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values (",table,col_names);
> > 980c977
> > < printf("insert into %s.%s %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values ('%i',",table,col_names,j);
> > 1050c1047
> > < printf("insert into \"%s.%s\" %s values(",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values(",table,col_names);
> > 1052c1049
> > < printf("insert into \"%s.%s\" %s values('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values('%i',",table,col_names,j);
> > 1056c1053
> > < printf("insert into %s.%s %s values(",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values(",table,col_names);
> > 1058c1055
> > < printf("insert into %s.%s %s values('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values('%i',",table,col_names,j);
> > 1170c1167
> > < printf("insert into \"%s.%s\" %s values (",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values (",table,col_names);
> > 1172c1169
> > < printf("insert into \"%s.%s\" %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values ('%i',",table,col_names,j);
> > 1176c1173
> > < printf("insert into %s.%s %s values (",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values (",table,col_names);
> > 1178c1175
> > < printf("insert into %s.%s %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values ('%i',",table,col_names,j);
> > 1246c1243
> > < printf("insert into \"%s.%s\" %s values (",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values (",table,col_names);
> > 1248c1245
> > < printf("insert into \"%s.%s\" %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values ('%i',",table,col_names,j);
> > 1252c1249
> > < printf("insert into %s.%s %s values (",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values (",table,col_names);
> > 1254c1251
> > < printf("insert into %s.%s %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values ('%i',",table,col_names,j);
> > 1324c1321
> > < printf("insert into \"%s.%s\" %s values (",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values (",table,col_names);
> > 1326c1323
> > < printf("insert into \"%s.%s\" %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values ('%i',",table,col_names,j);
> > 1330c1327
> > < printf("insert into %s.%s %s values (",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values (",table,col_names);
> > 1332c1329
> > < printf("insert into %s.%s %s values ('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values ('%i',",table,col_names,j);
> > 1439c1436
> > < tot_rings = ring_check(obj,schema,table,sr_id,tot_rings,hDBFHandle);
> > ---
> > > tot_rings = ring_check(obj,table,sr_id,tot_rings,hDBFHandle);
> > 1477c1474
> > < printf("insert into \"%s.%s\" %s values(",schema,table,col_names);
> > ---
> > > printf("insert into \"%s\" %s values(",table,col_names);
> > 1479c1476
> > < printf("insert into \"%s.%s\" %s values('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into \"%s\" %s values('%i',",table,col_names,j);
> > 1483c1480
> > < printf("insert into %s.%s %s values(",schema,table,col_names);
> > ---
> > > printf("insert into %s %s values(",table,col_names);
> > 1485c1482
> > < printf("insert into %s.%s %s values('%i',",schema,table,col_names,j);
> > ---
> > > printf("insert into %s %s values('%i',",table,col_names,j);
> > 1537c1534
> > < printf("\nALTER TABLE ONLY %s.%s ADD CONSTRAINT %s_pkey PRIMARY KEY (gid);\n",schema,table,table);
> > ---
> > > printf("\nALTER TABLE ONLY %s ADD CONSTRAINT %s_pkey PRIMARY KEY (gid);\n",table,table);
> > 1539c1536
> > < printf("SELECT setval ('%s.%s_gid_seq', %i, true);\n", schema,table, j-1);
> > ---
> > > printf("SELECT setval ('%s_gid_seq', %i, true);\n", table, j-1);
>
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
More information about the postgis-users
mailing list