Skip to content
Snippets Groups Projects
  1. Jan 05, 2019
  2. Dec 13, 2018
  3. Nov 15, 2018
    • N.Tatunov's avatar
      sql: remove GLOB from Tarantool · 5e3c0a1b
      N.Tatunov authored
      GLOB is a legacy extension for LIKE from SQLite. As we want our SQL to
      be close to ANSI SQL & LIKE to depend on collations, we do not want to
      support it. This patch totally removes it from Tarantool along with any
      mentions of it.
      
      Part of #3589
      Part of #3572
      5e3c0a1b
  4. Nov 02, 2018
    • Georgy Kirichenko's avatar
      sql: pass true types of columns to Tarantool · 7752cdfd
      Georgy Kirichenko authored
      As a main part of introducing strict typing in SQL it is required to
      prohibit typeless columns in parser's grammar. Originally, SQLite simply
      assigns typeless columns to BLOB affinity. Moreover, due to historical
      reasons, all columns were stored with <SCALAR> type in Tarantool core
      (except for <INTEGER> when it comes to primary key).  Column type should
      be defined on table creation. Allowed data types are: <TEXT>, <VARCHAR>,
      <CHAR>, <BLOB>, <INT[EGER]>, <REAL>, <FLOAT>, <NUMERIC>, <DECIMAL>,
      <DOUBLE> <DATE> and <DATETIME>. However, still any declared data type is
      converted to one of <BLOB>, <TEXT>, <REAL> or <INTEGER> affinities.
      While affinity reaches space format, it is (again) converted to
      Tarantool's field type. To be more precise, table of conversions:
      
      +----------+----------+------------+
      | SQL TYPE | AFFINITY | FIELD TYPE |
      +----------+----------+------------+
      | FLOAT    | REAL     | NUMBER     |
      | REAL     | REAL     | NUMBER     |
      | DOUBLE   | REAL     | NUMBER     |
      | NUMERIC  | REAL     | NUMBER     |
      | DECIMAL  | REAL     | NUMBER     |
      | INTEGER  | INTEGER  | INTEGER    |
      | TEXT     | TEXT     | STRING     |
      | VARCHAR  | TEXT     | STRING     |
      | CHAR     | TEXT     | STRING     |
      | BLOB     | BLOB     | SCALAR     |
      | DATETIME | REAL     | NUMBER     |
      | DATE     | REAL     | NUMBER     |
      | TIME     | REAL     | NUMBER     |
      +----------+----------+------------+
      
      <VARCHAR> and <CHAR> types should be specified with length
      (e.g. name VARCHAR(10)), but this length currently is not used when
      types are processed. Only purpose is to support ANSI syntax.
      The same for <NUMERIC> and <DECIMAL> - it is allowed to specify scale
      and precision, but they don't affect the way they are stored in memory.
      
      Note that patch is not self-sufficient: a lot of tests still fail due to
      wrong types conversions. Fix for that comes as next two patches.
      
      Closes #3018
      Closes #3104
      Closes #2494
      Closes #3459
      7752cdfd
  5. Sep 25, 2018
    • Serge Petrenko's avatar
      tarantoolctl: fix cat and play for empty body requests · 24a87ff2
      Serge Petrenko authored
      If space.before_replace returns the old tuple, the operation turns into
      no-op, but is still written to WAL as IPROTO_NOP for the sake of
      replication. Such a request doesn't have a body, and tarantoolctl failed
      to parse such requests in `tarantoolctl cat` and `tarantoolctl play`.
      Fix this by checking whether a request has a body. Also skip such
      requests in `play`, since they have no effect, and, while we're at it,
      make sure `play` and `cat` do not read excess rows with lsn>=to in case
      these rows are skipped.
      
      Closes #3675
      24a87ff2
  6. Sep 22, 2018
  7. Sep 19, 2018
    • Nikita Pettik's avatar
      sql: remove SQLite original struct Index · 6b8acd8f
      Nikita Pettik authored
      As a part of SQL DD integration it is required to substitute SQLite
      structure representing index with one from Tarantool internals.
      To make this happen, lets add surrogate space to Table, which will
      hold array of indexes. Those indexes are not real copies from Tarantool
      core, but contain only index_def, since only def is useful during query
      compilation.
      
      Note that in new implementation indexes are held as array and added to
      that array in straight order. In SQLite indexes are arranged in list and
      added to the head. Hence, the order of indexes is reversed. It results
      in different query plans: if planner must make choice of two equal
      indexes, it chooses simply first one. Due to this change, some tests are
      fixed.
      
      Moreover, alongside with substituting index struct, <REINDEX> statement
      and routine connected with it has been completely removed.
      
      Part of #3561
      6b8acd8f
  8. Sep 06, 2018
    • Georgy Kirichenko's avatar
      Tarantool static build ability · cb1c72da
      Georgy Kirichenko authored
      A possibility to build tarantool with included library dependencies.
      Use the flag -DBUILD_STATIC=ON to build statically against curl, readline,
      ncurses, icu and z.
      Use the flag -DOPENSSL_USE_STATIC_LIBS=ON to build with static
      openssl
      
      Changes:
        * Add FindOpenSSL.cmake because some distributions do not support the use of
        openssl static libraries.
        * Find libssl before curl because of build dependency.
        * Catch all bundled libraries API and export then it in case of static
        build.
        * Rename crc32 internal functions to avoid a name clash with linked libraries.
      
      Notes:
        * Bundled libyaml is not properly exported, use the system one.
        * Dockerfile to build static with docker is included
      
      Fixes #3445
      cb1c72da
  9. Aug 29, 2018
    • Nikita Pettik's avatar
      sql: remove support of ALTER TABLE ADD COLUMN · 0fc619b4
      Nikita Pettik authored
      We disabled ALTER TABLE ADD COLUMN long ago (i.e. banned in parser
      ability to process this statement), but internal functions for handling
      this routine have remained. This patch removes them as well.
      
      Part of #3561
      0fc619b4
  10. Aug 21, 2018
  11. Aug 20, 2018
    • Vladimir Davydov's avatar
      tarantoolctl: remove confusing message on eval error · dc648b99
      Vladimir Davydov authored
      If `tarantoolctl eval` fails, apart from returning 3 and printing the
      eval error to stderr, tarantoolctl will also emit the following message:
      
        Error while reloading config:
      
      This message is quite confusing and useless too, as we have the return
      code for that. Let's zap it.
      
      Closes #3560
      dc648b99
  12. Aug 16, 2018
  13. Aug 15, 2018
    • Eugine Blikh's avatar
      Introduce luaT_tolstring · 01c32701
      Eugine Blikh authored
      `lua_tostring`/`lua_tolstring` ignores metatable/boolean/nil and return NULL,
      but sometimes it's needed to have similar behaviour, like lua functions
      tostring. Lua 5.1 and LuaJIT ignores it by default, Lua 5.2 introduced
      auxilary function luaL_to(l)string with supporting of __tostring. This
      function is backport of Lua 5.1 "lauxlib.h"s luaL_tostring in the luaT
      namespace.
      01c32701
  14. Aug 14, 2018
  15. Aug 07, 2018
    • Nikita Pettik's avatar
      sql: remove SQLITE_OMIT_FOREIGN_KEY define guard · 502fb2b4
      Nikita Pettik authored
      We always compile with enabled foreign keys constraints. They still can
      be turned off by <pragma foreign_keys = false> in runtime.
      
      Follow-up #3271
      502fb2b4
    • Nikita Pettik's avatar
      sql: introduce ADD CONSTRAINT statement · 4fe0b812
      Nikita Pettik authored
      After introducing separate space for persisting foreign key
      constraints, nothing prevents us from adding ALTER TABLE statement to
      add or drop named constraints. According to ANSI syntax is following:
      
      ALTER TABLE <referencing table> ADD CONSTRAINT
        <referential constraint name> FOREIGN KEY
        <left paren> <referencing columns> <right paren> REFERENCES
        <referenced table> [ <referenced columns> ] [ MATCH <match type> ]
        [ <referential triggered action> ] [ <constraint check time> ]
      
      ALTER TABLE <referencing table> DROP CONSTRAINT <constrain name>
      
      In our terms it looks like:
      
      ALTER TABLE t1 ADD CONSTRAINT f1 FOREIGN KEY(id, a)
          REFERENCES t2 (id, b) MATCH FULL;
      ALTER TABLE t1 DROP CONSTRAINT f1;
      
      FK constraints which come with CREATE TABLE statement are also
      persisted with auto-generated name. They are coded after space and its
      indexes.
      
      Moreover, we don't use original SQLite foreign keys anymore: those
      obsolete structs have been removed alongside FK hash. Now FK constraints
      are stored only in space.
      
      Since types of referencing and referenced fields must match, and now in
      SQL only PK is allowed to feature INT (other fields are always SCALAR),
      some tests have been corrected to obey this rule.
      
      Part of #3271
      4fe0b812
  16. Aug 02, 2018
    • Mergen Imeev's avatar
      sql: tarantoolctl "enter" with set language · 0fad68d3
      Mergen Imeev authored
      This patch allow to use option "--language" with
      "tarantoolctl enter" command. Also default value
      for language were added in default configuration
      file. Language is either SQL or Lua.
      
      Closes #2385.
      
      @TarantoolBot document
      Title: Language selection for tarantoolctl
      "enter".
      User can select either Lua or SQL when he uses tarantoolctl
       "enter" command. It can be done using "--language=<language>"
      syntax. Default language is set in tarantoolctl config file.
      Usage:
      tarantoolctl enter <app_name> --language=SQL
      tarantoolctl enter <app_name> --language=Lua
      0fad68d3
  17. Jul 31, 2018
  18. Jul 27, 2018
    • Kirill Shcherbatov's avatar
      sql: introduce TRUNCATE TABLE operation · dbe38b0d
      Kirill Shcherbatov authored
      To implement new TRUNCATE operation, we have introduced a
      new P2 argument for OP_Clear opcode that calles box_truncate
      instead of tarantoolSqlite3ClearTable.
      This operation should work faster than DELETE FROM; but have
      a few restricts.
      
      Closes #2201.
      
      @TarantoolBot document
      Title: New TRUNCATE operation
      TRUNCATE is DDL operation.
      Removes all rows from a table or specified partitions of a table,
      without logging the individual row deletions.
      TRUNCATE TABLE is similar to the DELETE statement with no WHERE
      clause; however, TRUNCATE TABLE is faster and uses fewer system
      resources.
      It couldn't be used with system tables or with tables having FKs.
      It also couldn't be called in transaction.
      The triggers on table will have ignored.
      Example:
      TRUNCATE TABLE t1;
      dbe38b0d
  19. Jul 20, 2018
    • N.Tatunov's avatar
      sql: remove 'BEGIN TRANSACTION' · a00a128d
      N.Tatunov authored
      Previously "BEGIN" / "BEGIN TRANSACTION", "COMMIT TRANSACTION" /
      "END" / "END TRANSACTION", "ROLLBACK TRANSACTION" could be used
      to handle transactions. By changing these commands syntax in
      parser we're aiming on getting closer to ANSI SQL. Also found
      initialization in ifdef that caused some problems with error
      messages in occasions when the wrong syntax was used.
      
      With the patch applied only following commands can be used:
       - "START TRANSACTION" to begin transaction.
       - "COMMIT" to end transaction.
       - "ROLLBACK" to rollback transaction without savepoints.
       - "ROLLBACK TO .." to rollback transaction to savepoint.
      
      Closes #2164
      a00a128d
  20. Jul 13, 2018
  21. Jul 09, 2018
  22. Jul 05, 2018
    • Ilya Markov's avatar
      tarantoolctl: Add new options for rocks · 9d315ce4
      Ilya Markov authored
      Add propagation to luarocks of --only-server, --server keys.
      
      Closes #2640
      9d315ce4
    • Serge Petrenko's avatar
      Detect when instance is run or restarted by tarantoolctl. · b11e595a
      Serge Petrenko authored
      There are some hacks to know the instance was run by tarantoolctl,
      none of them are too reliable, though. This patch introduces 2
      environment variables set by tarantoolctl for the instance to
      know when it's being run or restarted.
      
      Closes: #3215
      
      @TarantoolBot document
      Title: tarantoolctl: document setting environment variables
      tarantoolctl sets the `TARANTOOLCTL` environment variable when starting
      an instance, and sets the `TARANTOOL_RESTARTED' environment variable
      when restarting.
      b11e595a
  23. Jun 29, 2018
    • AKhatskevich's avatar
      sql: export `sql_current_time` && enable tests · cebe6930
      AKhatskevich authored
      `sql_current_time` is exported only in debug mode and used to check
      builtin datetime sql functions behavior in specific time moments.
      
      Extra changes:
       * table-14.1 test is deleted, as it does not test anything.
         It was testing ddl inside of a transaction. This case is checked
         by 14.2 by now.
      
      Closes #2646
      cebe6930
  24. Jun 28, 2018
  25. Jun 19, 2018
  26. May 30, 2018
    • Mergen Imeev's avatar
      sql: IS is only applicable when dealing with NULL · b3a3ddb5
      Mergen Imeev authored
      According to ANSI Standard IS/IS NOT can be used to determine
      if values is null. At the same time in SQLite3 IS/IS NOT have an
      additional function - it can be used to check equality of two
      values. This feature isn't common for different versions of SQL
      (only in PL/SQL right operand can be NONE, TRUE of FALSE) This
      patch removes described function.
      b3a3ddb5
  27. May 24, 2018
    • Kirill Yukhin's avatar
      sql: allow any space symbols to be a white space · 14fed5d6
      Kirill Yukhin authored
      ANSI SQL allows any of Unicode classes ZI, Zp or Zs to
      act as white space symbol. Allow this in lexical analyzer.
      Refactor lexical analyzer routine to follow Tarantool's
      coding style.
      Also, remove dead encoding: EBCDIC.
      
      Closes #2371
      14fed5d6
  28. May 15, 2018
    • Nikita Pettik's avatar
      sql: move SQL statistics to server · 17525ed8
      Nikita Pettik authored
      SQLite provides kind of statistics concerning data holding in each index
      and space. It is used to help query planner build optimized plan. Such
      statistics don't depend on internal index implementation (e.g. B-tree or
      LSM tree) and contain information concerning tuple distribution.
      This patch moves members responsible statistics from original SQLite
      structs to Tarantool ones. To be more precise, now index's opts contains
      statistics from _stat1 space (arrays of integers and their logarithm
      approximation) and more sophisticated one from _stat4 (array of samples).
      It also contains set of flags to turn on/off different optimizations
      (such as skip-scan).
      
      After ANALYZE command is executed, statistics are saved into _sql_stat1
      and _sql_stat4 spaces (in order to persist them). However, it should also
      be loaded into in-memory structs representing indexes. This patch
      reworks original SQLite routine to load it directly to newly introduced
      stat struct of index.
      
      It is worth mentioning that during update of statistics occurs according
      to 'everything or nothing' policy: firstly, it is allocated on the
      region. Then, if there is enough memory for stats of ALL indexes it is
      copied to the heap. Otherwise, region is truncated and no changes take
      place.
      
      Closes #3253
      17525ed8
  29. May 11, 2018
    • Nikita Pettik's avatar
      sql: remove OP_AutoCommit opcode · 325e2a1d
      Nikita Pettik authored
      In SQLite OP_AutoCommit opcode used to set transaction operation:
      BEGIN, ROLLBACK and COMMIT, switching auto-commit flag in VDBE.
      As for Tarantool, it is confusing, since there are some differences
      between auto-commit modes: 'INSERT ...  VALUES (1), (2), (3)' is one
      indivisible operation for SQLite, and three operations in real
      auto-commit mode for Tarantool. To simulate SQLite auto-commit mode,
      these three insertions are wrapped into one SEPARATE transaction,
      which is, in fact, not real autocommit mode.
      So, lets add separate explicit opcodes to BEGIN, ROLLBACK and COMMIT
      transactions as user's operations. Auto-commit mode is set once at VDBE
      creation and can be changed only by implicit opcode OP_TTransaction,
      which is added to each DML statement, or by 'BEGIN' SQL statement.
      325e2a1d
  30. Apr 22, 2018
    • Alexander Turenko's avatar
      Remove autogenerated files · 1473e30e
      Alexander Turenko authored
      Rewrote TCL scripts as posix shell ones, enabled SQL_MAINTAINER_MODE
      commands unconditionally.
      
      Rewrote cmake targets to generate those files in a build directory
      instead of the source directory.
      
      Fixes #3183.
      1473e30e
  31. Apr 18, 2018
  32. Apr 04, 2018
  33. Mar 07, 2018
    • Bulat Niatshin's avatar
      sql: remove OP_Transaction · b080a7f0
      Bulat Niatshin authored
      OP_Transaction in its current state was completely
      unnecessary. In this patch it was removed, all
      related code was refactored, opcodes set was
      regenerated.
      
      For #3119
      b080a7f0
  34. Jan 23, 2018
    • Kirill Yukhin's avatar
      sql: Ban ALTER TABLE ADD COLUMN · 5163872d
      Kirill Yukhin authored
      Currently, only ALTER TABLE RENAME is supported in SQL. Ban
      ALTER TABLE ADD COLUMN in the grammar until it is supported.
      Corresponding issue submitted: #3075
      
      Closes #2607
      5163872d
Loading