You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Semyon Danilov (Jira)" <ji...@apache.org> on 2021/01/21 14:29:00 UTC

[jira] [Comment Edited] (IGNITE-14029) Inconsistent handling of tables with non primary key columns

    [ https://issues.apache.org/jira/browse/IGNITE-14029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17269338#comment-17269338 ] 

Semyon Danilov edited comment on IGNITE-14029 at 1/21/21, 2:28 PM:
-------------------------------------------------------------------

Hello, [~lukas.eder]! Thanks for raising this issue, it surely looks like a bug. Ignite doesn't allow tables with a primary key only for a reason: Ignite enforces
{code:java}
javax.cache.Cache#put{code}
contract, so the entry must not be null. On the other hand, the removal of the last non-primary key column shows inconsistency of Ignite's API. We'll look through it


was (Author: sdanilov):
Hello, [~lukas.eder]! Thanks for raising this issue, it surely looks like a bug. Ignite doesn't allow tables with a primary key only for a reason: Ignite enforces `javax.cache.Cache#put` contract, so the entry must not be null. On the other hand, the removal of the last non-primary key column shows inconsistency of Ignite's API. We'll look through it

> Inconsistent handling of tables with non primary key columns
> ------------------------------------------------------------
>
>                 Key: IGNITE-14029
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14029
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.9.1
>            Reporter: Lukas Eder
>            Priority: Major
>
> This doesn't work:
> {code:java}
> CREATE TABLE t (i int);{code}
> I'm getting this error
> {noformat}
> SQL Error [1001] [42000]: No PRIMARY KEY defined for CREATE TABLE{noformat}
> However, this works perfectly fine:
> {code:java}
> CREATE TABLE t (i int PRIMARY KEY, dummy int);
> ALTER TABLE t DROP dummy;{code}
> I must say, I don't fully understand this arbitrary restriction. There are good reasons for tables to consist only of a primary key, when a schema is properly normalised. In any case, if there are good reasons to prevent tables without non primary key columns, then the ALTER TABLE statement must ensure this state is not achievable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)