Skip to content

Commit f0a6b71

Browse files
committed
Read the real PK from the wrapped table instead of re-querying DbSchema
Addresses PR feedback: the wrapped SimpleTable already holds the source SchemaTableInfo, so read the real PK via getRealTable() (the same idiom ContainerScopedTable.init() uses) rather than resolving the table again through _dbSchema.getTable(). Claude-Session: https://claude.ai/code/session_01YJwkmACfqMmYiAX15YbU1D
1 parent 212d269 commit f0a6b71

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ehr/src/org/labkey/ehr/query/EHRLookupsUserSchema.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ else if (EHRSchema.TABLE_LOOKUP_SETS.equalsIgnoreCase(name))
219219
// (e.g. project_types) get CustomPermissionsTable instead: the PK constraint already enforces uniqueness,
220220
// and container-scoping such a table made its key column non-insertable in the UI.
221221
String pkColName = getPkColName(ti);
222-
List<String> realPk = _dbSchema.getTable(name).getPkColumnNames();
222+
List<String> realPk = ti instanceof FilteredTable<?> ft
223+
? ft.getRealTable().getPkColumnNames()
224+
: _dbSchema.getTable(name).getPkColumnNames();
223225
boolean singleColumnPks = pkColName != null && realPk.size() == 1;
224226
boolean realPkMatchesPseudoPk = singleColumnPks && realPk.get(0).equalsIgnoreCase(pkColName);
225227

0 commit comments

Comments
 (0)