-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: support pg_catalog "system attributes" xmin, xmax etc #33296
Comments
I made a hack for this a long time ago to see if IntelliJ would work if we at least returned something for
|
Actually the proper implementation is not far from where you did this. It should indeed be in that function or the equivalent code in opt/build/scope.go. however it must kick in as fallback if the column name does not otherwise exist, not upfront. Also we probably want to recognize the other system attributes too. Also the type of the value should be oid not int. But you got the gist right.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Here's the doc for the system attributes: https://www.postgresql.org/docs/12/ddl-system-columns.html |
|
It's unlikely we can implement xmin/xmax in a way that's both compatible with pg and also correct wrt our own concurrency management. For those columns, I would rather go the way of docs for substitute approaches. |
lack of support for xmin column is affecting some test in efcore.pg |
It appears that PostgreSQL tables, especially tables in the pg_catalog, all support "system attributes".
A system attribute is a virtual column that is selectable in every table, even though it does not show up in its schema description (eg psql
\d
/ SHOW CREATE).See definitions in pg sources
src/backend/catalog/heap.c
.For example it is possible to do
select X.xmin from X
for every pg_catalog table X.Of course it is neither reasonable nor correct to simply add these attributes as regular columns:
The following attributes seem to be defined:
tableoid
: the oid of the containing tablectid
: the "physical location" of a row within its tablexmin
: the txn id of the inserting txnxmax
: the txn id of the deleting txn or 0cmin
: the command id of the inserting commandcmax
: the command id of the deleting command or 0Found while working on #31737
Jira issue: CRDB-4698
The text was updated successfully, but these errors were encountered: