Opened 18 years ago

Closed 15 years ago

#1571 closed enhancement (invalid)

Primary Key Determination

Reported by: refractions Owned by: pramsey
Priority: high Milestone:
Component: PostGIS Interface Version: unspecified
Severity: minor Keywords:
Cc:

Description

As of PgSLQ 8.1, the oid field is no longer present by default.  That means it is time to upgrade to use the 
following rules for key determination:
- If "USING UNIQUE" is present, use that (fast)
- Otherwise, check system table to see if a primary key is present and use that (fast),
- Otherwise, check and see if an oid is present and use that (slow),
- Otherwise, query just doesn't work.

Change History (4)

comment:1 by mark@…, 18 years ago

The current fix is not terribly robust.
The pk lookup searches for a single pk under the matching table name.  Multiple
pks are ignored.  Schema qualified tablenames currently fail.  The schema needs
to be separated from the tablename, and a qualified query performed to ensure
the pk of the correct table is returned.

comment:2 by mark@…, 18 years ago

New additions have been made to ensure that any schema name given on the data
line is stripped from the table name, and used to ensure that the proper primary
key is returned.  If the table is not schema qualified, the
pg_table_is_visible(oid) is used to restrict the table search to those in the
search path.  Additionally, a query that retrieves multiple results (ie.
multiple schemas on the search path containing a table of the correct name) the
primary key is no longer assumed to be the first one returned, as it's not
necessarily the first one on the search path.
What's left to resolve is and multiple primary keys.

comment:3 by pramsey, 15 years ago

Owner: changed from refractions to pramsey

comment:4 by pramsey, 15 years ago

Resolution: invalid
Status: newclosed

Current behavior is "good enough".

Note: See TracTickets for help on using tickets.