Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Konstantin Osipov <kostja@tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 1/6] sql: move constraint name to struct contraint_parse
Date: Thu, 17 Jan 2019 20:14:46 +0300	[thread overview]
Message-ID: <1C46D85F-B1BE-469B-9F14-87CC55C731F7@tarantool.org> (raw)
In-Reply-To: <20190117105613.GC28204@chai>



> On 17 Jan 2019, at 13:56, Konstantin Osipov <kostja@tarantool.org> wrote:
> 
> * n.pettik <korablev@tarantool.org> [19/01/16 23:09]:
>> struct constraint_parse {
>>        /** Name of table which constraint belongs to. */
>> -       struct SrcList *table_name;
>> +       struct SrcList *table;
>>        /** Name of the constraint currently being parsed. */
>>        struct Token name;
>> +       /**
>> +        * List of columns involved in constraint definition:
>> +        * indexed or referencing columns.
>> +        */
>> +       struct ExprList *cols;
> 
> Why not use constraint_def here and all future parser-specific
> objects? _def is our widely used abbreviation for "definition". A
> parser creates a constraint definition, and then it is used to
> create a runtime constraint object - struct constraint.

Do you suggest only rename this structure to constraint_def?
We don’t have constraint_def for the reason that every constraint
is stored in its own way: unique constraints as a part of indexes;
FK constraints are represented by fkey/fkey_def; check constraints
are stored as raw strings in space format. And they don’t have nothing
in common except for name (meanwhile in most cases it is
auto-generated name) and name of table they are related to.

If you suggest to use *for example* fkey_def instead of fkey_parse:
fkey_parse is used only within parser and contains parser specific
members: list of columns as they come from parser, indication of
self-referencing dependency etc.
I guess we are able to fit all these things in struct fkey_def, but is
it worth it? Note that fkey_parse is used ONLY during creation of FK,
other manipulations depend on fkey_def/fkey from struct space.

Also, see snippet in the second letter, mb it is exactly what you want.

  reply	other threads:[~2019-01-17 17:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 12:13 [tarantool-patches] [PATCH 0/6] Introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PK Nikita Pettik
2019-01-09 12:13 ` [tarantool-patches] [PATCH 1/6] sql: move constraint name to struct contraint_parse Nikita Pettik
2019-01-14 14:04   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 20:06     ` n.pettik
2019-01-16 20:54       ` Vladislav Shpilevoy
2019-01-17 10:56       ` Konstantin Osipov
2019-01-17 17:14         ` n.pettik [this message]
2019-01-09 12:13 ` [tarantool-patches] [PATCH 2/6] sql: rework ALTER TABLE grammar Nikita Pettik
2019-01-14 14:05   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 20:06     ` n.pettik
2019-01-16 20:54       ` Vladislav Shpilevoy
2019-01-17 11:51   ` Konstantin Osipov
2019-01-17 17:14     ` n.pettik
2019-01-18  1:42       ` Konstantin Osipov
2019-01-09 12:13 ` [tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args Nikita Pettik
2019-01-09 12:13 ` [tarantool-patches] [PATCH 4/6] sql: refactor getNewIid() function Nikita Pettik
2019-01-14 14:05   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-09 12:13 ` [tarantool-patches] [PATCH 5/6] sql: fix error message for improperly created index Nikita Pettik
2019-01-14 14:06   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 20:06     ` n.pettik
2019-01-09 12:13 ` [tarantool-patches] [PATCH 6/6] sql: introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PRIMARY KEY Nikita Pettik
2019-01-14 14:06   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 20:06     ` n.pettik
2019-01-16 20:54       ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1C46D85F-B1BE-469B-9F14-87CC55C731F7@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 1/6] sql: move constraint name to struct contraint_parse' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox