[
https://issues.apache.org/jira/browse/CASSANDRA-5715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylvain Lebresne updated CASSANDRA-5715:
----------------------------------------
Attachment: 5715-v2.txt
I'm not convinced by your arguments either tbh :). I do think doing the
restriction might be slightly annoying for some tools (measurably more so than
if we don't do such restriction) and if anything, I'm more worried about such
restriction somewhat "blurring" the fact that INSERT and UPDATE are the same
for SQL people than forcing some "good style". I also liked the idea of being
able to say that "UPDATE is the more generic one and you can do everything with
it" but that's not much of an argument.
Anyway, this is not very important and if we do that restriction, I suppose
it's coherent to not bother with the {{UPDATE test SET PRIMARY KEY}} syntax,
which is not necessarily a bad thing. So attaching a v2 patch (that is really
an alternative to the 2 other patch) that enforce said restriction.
> CAS on 'primary key only' table
> -------------------------------
>
> Key: CASSANDRA-5715
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5715
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Sylvain Lebresne
> Assignee: Sylvain Lebresne
> Priority: Minor
> Fix For: 2.0
>
> Attachments: 0001-Conditions-on-INSERT.txt,
> 0002-Support-updating-the-PK-only.txt, 5715-v2.txt
>
>
> Given a table with only a primary key, like
> {noformat}
> CREATE TABLE test (k int PRIMARY KEY)
> {noformat}
> there is currently no way to CAS a row in that table into existing because:
> # INSERT doesn't currently support IF
> # UPDATE has no way to update such table
> So we should probably allow IF conditions on INSERT statements.
> In addition (or alternatively), we could work on allowing UPDATE to update
> such table. One motivation for that could be to make UPDATE always be more
> general to INSERT. That is currently, there is a bunch of operation that
> INSERT cannot do (counter increments, collection appends), but that "primary
> key table" case is, afaik, the only case where you *need* to use INSERT.
> However, because CQL forces segregation of PK value to the WHERE clause and
> not to the SET one, the only syntax that I can see work would be:
> {noformat}
> UPDATE WHERE k=0;
> {noformat}
> which maybe is too ugly to allow?
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira