Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2945 closed defect (fixed)

postgres driver failes to create geometry index if layer name starts with a number

Reported by: winkey Owned by: chaitanya
Priority: normal Milestone: 1.6.1
Component: OGR_SF Version: unspecified
Severity: normal Keywords: postgres postgis PG
Cc: warmerdam

Description

ERROR 1: 'CREATE INDEX 500hgt_geom_idx ON "public"."500hgt" USING GIST ("wkb_geometry")' failed for layer 500hgt, layer creation has failed.

index name needs to be quoted

in ogrpgdatasource.cpp around line 1291

            osCommand.Printf("CREATE INDEX %s_geom_idx ON \"%s\".\"%s\" USING GIST (\"%s\")",
                    pszTableName, pszSchemaName, pszTableName, pszGFldName);

should be

            osCommand.Printf("CREATE INDEX \"%s_geom_idx\" ON \"%s\".\"%s\" USING GIST (\"%s\")",
                    pszTableName, pszSchemaName, pszTableName, pszGFldName);

Change History (3)

comment:1 by warmerdam, 15 years ago

Cc: warmerdam added
Component: defaultOGR_SF
Keywords: postgres postgis PG added
Milestone: 1.6.1
Owner: changed from warmerdam to chaitanya

Chaitanya,

Please setup a postgis database for testing (if you don't already have one), confirm the problem, confirm the fix and apply in trunk and 1.6.

comment:2 by chaitanya, 15 years ago

Resolution: fixed
Status: newclosed

Committed to trunk (r16765) and 1.6 (r16766)

comment:3 by Even Rouault, 15 years ago

Additionnal quoting for geometry and FID columns added in trunk (r16807) and branches/1.6 (r16808). Test added in r16809

Note: See TracTickets for help on using tickets.