From: Mergen Imeev <imeevma@tarantool.org> To: Nikita Pettik <korablev@tarantool.org> Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org Subject: Re: [Tarantool-patches] [PATCH v5 2/5] sql: remove PRAGMA "short_column_names" Date: Sun, 29 Dec 2019 15:58:25 +0300 [thread overview] Message-ID: <20191229125825.GC21920@tarantool.org> (raw) In-Reply-To: <20191227165522.GK18639@tarantool.org> Hi! Thank you for remarks. My answers below. On Fri, Dec 27, 2019 at 06:55:22PM +0200, Nikita Pettik wrote: > On 27 Dec 14:18, imeevma@tarantool.org wrote: > > The pragmas "short_column_names" and "full_column_names" allow us > > to use three ways to display the column name in metadata: > > 1) If both are turned off, then the column name was shown as it > > was written by the user. > > 2) If "short_column_names" = OFF and "full_column_names" = ON, > > then the column name is displayed as <table name>.<column name>. > > 3) If "short_column_names" = ON, then the column name is displayed > > as <column name>. This is the default option. > > Don't get the difference between first and last options. Also see > https://www.sqlite.org/pragma.html#pragma_full_column_names > Here you can see behaiour in the first case: tarantool> CREATE TABLE t(i INT PRIMARY KEY); --- - row_count: 1 ... tarantool> SELECT t . i from t; --- - metadata: - name: t . i type: integer rows: [] ... As we can see, the name is "t . i". In the third case: tarantool> SELECT t . i from t; --- - metadata: - name: I type: integer rows: [] ... > > But we need only two ways to show the column name: > > 1) Show the column name as <column name>. This should be the > > default option. > > 2) Show the column name as <table name>.<column name>. > > > > In this regard, we need only one of these pragmas. > > > > @@ -1827,12 +1824,11 @@ generate_column_metadata(struct Parse *pParse, struct SrcList *pTabList, > > assert(iCol >= 0 && iCol < (int)space_def->field_count); > > zCol = space_def->fields[iCol].name; > > const char *name = NULL; > > + > > > > Extra new line. Please, remove. > Fixed. > > if (pEList->a[i].zName != NULL) { > > name = pEList->a[i].zName; > > } else { > > - if (!shortNames && !fullNames) { > > - name = pEList->a[i].zSpan; > > - } else if (fullNames) { > > + if (pParse->sql_flags & SQL_FullColNames) { > > (pParse->sql_flags & SQL_FullColNames) != 0 > Fixed. > > name = tt_sprintf("%s.%s", > > space_def->name, > > zCol); > > @@ -2053,8 +2049,7 @@ sqlResultSetOfSelect(Parse * pParse, Select * pSelect) > > sql *db = pParse->db; > > > > uint32_t saved_flags = pParse->sql_flags; > > - pParse->sql_flags |= ~SQL_FullColNames; > > - pParse->sql_flags &= SQL_ShortColNames; > > + pParse->sql_flags = 0; > > Why do you set sql_flags to zero? > After "pParse->sql_flags &= SQL_ShortColNames;" all but one(SQL_ShortColNames) bits will be 0. Since we remove SQL_ShortColNames, all bits will be 0. > > sqlSelectPrep(pParse, pSelect, 0); > > if (pParse->is_aborted) > > return NULL; > > I comment your patch since I've faced the same necessity to remove > short_column_names. So to avoid doubling work, I'am going to cherry- > pick your patch (or push it to the master out of order). >
next prev parent reply other threads:[~2019-12-29 12:58 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-27 11:18 [Tarantool-patches] [PATCH v5 0/5] Remove control pragmas imeevma 2019-12-27 11:18 ` [Tarantool-patches] [PATCH v5 1/5] sql: remove PRAGMA "count_changes" imeevma 2019-12-27 11:18 ` [Tarantool-patches] [PATCH v5 2/5] sql: remove PRAGMA "short_column_names" imeevma 2019-12-27 16:55 ` Nikita Pettik 2019-12-29 12:58 ` Mergen Imeev [this message] 2019-12-27 11:18 ` [Tarantool-patches] [PATCH v5 3/5] sql: remove PRAGMA "sql_compound_select_limit" imeevma 2019-12-27 11:18 ` [Tarantool-patches] [PATCH v5 4/5] sql: remove control pragmas imeevma 2019-12-27 15:26 ` Vladislav Shpilevoy 2019-12-29 12:44 ` Mergen Imeev 2019-12-29 12:59 ` Mergen Imeev 2019-12-29 13:23 ` Mergen Imeev 2019-12-27 11:18 ` [Tarantool-patches] [PATCH v5 5/5] sql: refactor PRAGMA-related code imeevma 2019-12-27 15:26 ` Vladislav Shpilevoy 2019-12-29 12:46 ` Mergen Imeev 2019-12-30 10:19 [Tarantool-patches] [PATCH v5 0/5] Remove control pragmas imeevma 2019-12-30 10:19 ` [Tarantool-patches] [PATCH v5 2/5] sql: remove PRAGMA "short_column_names" imeevma
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=20191229125825.GC21920@tarantool.org \ --to=imeevma@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v5 2/5] sql: remove PRAGMA "short_column_names"' \ /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