Issue Details (XML | Word | Printable)

Key: CORE-4768
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Pavel Zotov
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

CREATE USER ... TAGS ( argument_1 = 'value1', ..., argument_N = 'valueN' ) - wrong results of statement when there are many arguments

Created: 21/Apr/15 05:57 PM   Updated: 12/Jun/18 07:44 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0 Beta 2

File Attachments: 1. Zip Archive (30 kB)

QA Status: Done successfully
Test Specifics: Custom configuration required

 Description  « Hide
The following batch will create statement like this:
drop user usr_01;
create user usr_01 password '123' tags (
    arg_00001='value 00001'
   ,arg_00002='value 00002'
   ,arg_00003='value 00003'
   , . . .
   ,arg_NNNN='value NNNN'

-- and then extract data from sec$users and sec$attributes for newly created user 'usr_01':

    cast(u.sec$user_name as char(10)) login,
    cast(a.sec$key as char(20)) tag,
    cast(a.sec$value as char(25)) val,
    sec$plugin sec_plg
from sec$users u
left join sec$user_attributes a on u.sec$user_name = a.sec$user_name
where u.sec$user_name = upper('usr_01');

@echo off
setlocal enabledelayedexpansion enableextensions
set sql=ctags-tmp.sql
del %sql% 2>nul
set tq=%1
if .%1.==.. set tq=10
echo drop user usr_01;>>%sql%
echo commit;>>%sql%
echo create user usr_01 password '123' tags (>>%sql%
for /l %%i in (1,1,%tq%) do (
  set /a k=100000+%%i
  set k=!k:~-5!
  if .%%i.==.1. (
    echo arg_!k!='value !k!'>>%sql%
  ) else (
    echo ,arg_!k!='value !k!'>>%sql%
echo );>>%sql%
echo commit;>>%sql%

echo set width sec_plg 7;>>%sql%
echo select>>%sql%
echo cast(u.sec$user_name as char(10)) login,>>%sql%
echo cast(a.sec$key as char(20)) tag,>>%sql%
echo cast(a.sec$value as char(25)) val,>>%sql%
echo sec$plugin sec_plg>>%sql%
echo from sec$users u>>%sql%
echo left join sec$user_attributes a on u.sec$user_name = a.sec$user_name>>%sql%
echo where u.sec$user_name = upper('usr_01');>>%sql%

When I run this batch with argument %1 = 6000 it will create pretty big script 'ctags-tmp.sql' that is in attach.
This script:

C:\MIX\firebird\fb30\isql.exe localhost/3333:e30 -pag 9999999 -i ctags-tmp.sql 1>log 2>err

-- works WITHOUT any error, i.e. user `u01` and his attributes (tags) are created OK.

But in fact NOT ALL attributes which are specified in .sql will be created, only ~40 instead of required 6000 (please look in attach result of this script).

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Zotov added a comment - 21/Apr/15 06:05 PM

Launching batch with argument = 2978 will produce .sql that DOES store all 2978 attributes. But launching with arg = 2979 will broke everything:

========== ==================== ========================= =======
USR_01 AR Srp

(yes, only 'half' of some attribute is stored - cant` see even its number)

Alexander Peshkov added a comment - 27/Apr/15 09:41 AM
Also fixed engine to make it raise error on too big segmented blob put.