@@ -407,13 +407,16 @@ func (h *Hub) GetPathKeys(opts types.Options) ([]types.PathKey, error) {
407407 return nil , err
408408 }
409409
410- connectionSchema , ok := connectionPlugin .ConnectionMap [connectionName ]
410+ connectionSchema , err := connectionPlugin .GetSchema (connectionName )
411+ if err != nil {
412+ return nil , err
413+ }
414+ tableSchema , ok := connectionSchema .Schema [table ]
411415 if ! ok {
412- return nil , fmt .Errorf ("no schema loaded for connection '%s'" , connectionName )
416+ return nil , fmt .Errorf ("no schema loaded for connection '%s', table '%s' " , connectionName , table )
413417 }
414- schema := connectionSchema .Schema .Schema [table ]
415- var allColumns = make ([]string , len (schema .Columns ))
416- for i , c := range schema .Columns {
418+ var allColumns = make ([]string , len (tableSchema .Columns ))
419+ for i , c := range tableSchema .Columns {
417420 allColumns [i ] = c .Name
418421 }
419422
@@ -422,10 +425,10 @@ func (h *Hub) GetPathKeys(opts types.Options) ([]types.PathKey, error) {
422425 // build path keys based on the table key columns
423426 // NOTE: the schema data has changed in SDK version 1.3 - we must handle plugins using legacy sdk explicitly
424427 // check for legacy sdk versions
425- if schema .ListCallKeyColumns != nil {
428+ if tableSchema .ListCallKeyColumns != nil {
426429 log .Printf ("[TRACE] schema response include ListCallKeyColumns, it is using legacy protobuff interface " )
427- pathKeys = types .LegacyKeyColumnsToPathKeys (schema .ListCallKeyColumns , schema .ListCallOptionalKeyColumns , allColumns )
428- } else if schema .ListCallKeyColumnList != nil {
430+ pathKeys = types .LegacyKeyColumnsToPathKeys (tableSchema .ListCallKeyColumns , tableSchema .ListCallOptionalKeyColumns , allColumns )
431+ } else if tableSchema .ListCallKeyColumnList != nil {
429432 log .Printf ("[TRACE] schema response include ListCallKeyColumnList, it is using the updated protobuff interface " )
430433 // generate path keys if there are required list key columns
431434 // this increases the chances that Postgres will generate a plan which provides the quals when querying the table
0 commit comments