You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Determining the (name of) the pk columns of a table can be done inside plugins, but requires digging into introspection details
So, this request if to have an easy api to get the pk columns (.getPKAttributes()?)
From my limited knowledge of Postgraphile and the comments on discord, it seem that that at least in one scenario one can have a reference to a codec and in other scenarios a pgClass and in both cases it should be possible to get the (name of the) pk column(s)
Oh that's for the gather phase where you're looking at introspection and creating codecs/resources.
If you're in the schema phase turning codecs/resources into GraphQL things then:
a codec doesn't have a primary key, it's just a description of a data type (that type could be shared by tables, function return types, etc)
from a resource you can do resource.uniques.find(u => u.isPrimary)?.attributes
it's quite common to look for the non-function resource that relates to a codec, though it's not guaranteed that there will be exactly one of these: there could be none, or there could be many (but that's extremely rare!). Typically that would be pgRegistry.pgResources.filter(r => r.codec === codec && !r.parameters) and then checks that the set contains exactly one entry, etc.
Feature description
Determining the (name of) the pk columns of a table can be done inside plugins, but requires digging into introspection details
So, this request if to have an easy api to get the pk columns (.getPKAttributes()?)
From my limited knowledge of Postgraphile and the comments on discord, it seem that that at least in one scenario one can have a reference to a codec and in other scenarios a pgClass and in both cases it should be possible to get the (name of the) pk column(s)
Motivating example
See https://discord.com/channels/489127045289476126/1296863704364879902/1298276538726481992
Breaking changes
Don't think so
Supporting development
I [tick all that apply]:
The text was updated successfully, but these errors were encountered: