Which column identifier should we use for DML operation #1147
Replies: 6 comments 16 replies
-
I strongly support adding the feature that allows the front end to give an alias to non-persisted columns. We'd then consider them "anonymous" otherwise, and so couldn't be referred to by steps further down some pipeline. Adding this feature would allow things like "filter by col1 + col2 > 10" and the like to be built up even if we don't have it pre-rolled. Currently, we aren't implementing building upon preexisting views. We also have no way to refer to a "column" of data resulting from a function application, since it won't have an id, and can't have an attnum. It seems like one or the other of those two features would be essential for any but the most basic or most curated tasks. |
Beta Was this translation helpful? Give feedback.
-
I think that by default, the word "column" in the API/frontend should refer to something that is persisted and has an ID. We should always use IDs to work with these objects in the API. I don't have a strong opinion on whether to use IDs or attnums or names internally for DML operations, I'll defer to @mathemancer here. For non-persisted columns, we should come up with a different word to describe the concept in the API. I am fine with using names instead of IDs to refer to these. Perhaps we could call these "temporary columns" or "virtual columns". |
Beta Was this translation helpful? Give feedback.
-
That is what makes it inconsistent when referring to them along with a persisted column in the same API. For example, when chaining, persisted column would be referenced by a column
@mathemancer or @dmos62 Would be better equipped to answer this question. Most of the concern is with regards to how to chain/nest queries since we are won't be using views for it. Edit: Looking at the View spec and the comments, it seems like the alpha release won't be supporting pipelining queries either. So it feels too early at this point. I am leaning towards using column |
Beta Was this translation helpful? Give feedback.
-
Currently, I think our only DML operations (for the user DB) are under
This would make things a bunch simpler for reasons we've discussed many times, and make DML operations more performant (performance matters much more for DML than DDL in general). If we enforce the conventions separating DDL and DML, and keep an eye on where DDL operations aren't (i.e., they can't be in the |
Beta Was this translation helpful? Give feedback.
-
Is it conceivable to use attnums instead of Django IDs? That would free us from having to do input/output translation to translate between Django IDs and names, since attnums (and other robust database-level identifiers) are allowed on the database layer. The translation between column ids and names has been costing a lot of time for me, and for others as well, I think. |
Beta Was this translation helpful? Give feedback.
-
The way I see this working is having different kinds of identifiers work in tandem. How DB functions currently address this is that column references are represented by two functions, one for each type of identifier supported: Whatever solution we choose, it has to be based on names, since that's the bread and butter of Postgres. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We have decided to use attnums for DDL operations based on our previous discussion, but there are a few issues that come up when we use attnums for our DML operations.
Brent and I had a sync call regarding the same and these are the notes for the discussion
Brent also feels like this is a good time to bring up the conversation as not considering non persisted columns could hamper the possible features of filters, query builder etc.
So how should we go about dealing with such issues that need a temporary aliased column?
Beta Was this translation helpful? Give feedback.
All reactions