Ticket #2945 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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

Changed 4 years ago by warmerdam

  • cc warmerdam added
  • keywords postgres postgis PG added
  • component changed from default to OGR_SF
  • owner changed from warmerdam to chaitanya
  • milestone set to 1.6.1

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.

Changed 4 years ago by chaitanya

  • status changed from new to closed
  • resolution set to fixed

Committed to trunk (r16765) and 1.6 (r16766)

Changed 4 years ago by rouault

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.