[Firebird-devel] [FB-Tracker] Created: (CORE-6544) ambigious column name '...'

2021-04-20 Thread Alexander Muylaert (JIRA)
ambigious column name '...'
---

 Key: CORE-6544
 URL: http://tracker.firebirdsql.org/browse/CORE-6544
 Project: Firebird Core
  Issue Type: Improvement
 Environment: Win10, x64
Reporter: Alexander Muylaert
 Attachments: image_2021_04_21T05_29_28_939Z.png

Hi

We had an accidental performance degrade because of a calculated field that 
should wasn't intended to be used in production.  The problem behind it was the 
SQL that was approved.  It contained ambiguous column names between tables.
It would be magnificent if you could fail on compile time, since this is a very 
dangerous situation.

In my example, bit T_ADDRESS and T_PROJECT have a field F_PERS_ID and the code 
I'm showing is the computed by of a calculated field.  The second (correct) 
implementation gives me a correct, fast result, while the first one, returns a 
full table scan.  What it should do...  But it would have saved us many stupid 
hours of debugging if the ambiguous warning would have been thrown.  A bit like 
in MS-SQL.

kind regards

Alexander



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6542) Implementation of SUBSTRING for multi-byte character sets is inefficient

2021-04-16 Thread Vlad Khorsun (JIRA)
Implementation of SUBSTRING for multi-byte character sets is inefficient 
-

 Key: CORE-6542
 URL: http://tracker.firebirdsql.org/browse/CORE-6542
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Vlad Khorsun


The case below shows bad performance of SUBSTRING for UTF8 comparing with 
(legacy) UNICODE_FSS 

a) UNICODE_FSS

execute block
as
declare str1 varchar(8000) character set unicode_fss;
declare str2 varchar(10)   character set unicode_fss;
declare n int = 10;
begin
  str1 = LPAD('abcd', 8000, '--');
  while (n > 0) do
  begin
str2 = SUBSTRING(str1 from 1 FOR 10);
n = n - 1;
  end
end

Execute time = 62ms


b) UTF8

execute block
as
declare str1 varchar(8000) character set utf8;
declare str2 varchar(10)   character set utf8;
declare n int = 10;
begin
  str1 = LPAD('abcd', 8000, '--');
  while (n > 0) do
  begin
str2 = SUBSTRING(str1 from 1 FOR 10);
n = n - 1;
  end
end

Execute time = 983ms

The case is simplified and based on end-user report. In user case the same 
query on the system tables run much longer with FB4 than with FB3
(test database was restored from the same backup). Origin of the problem is 
that FB4 uses UTF8 for metadata while FB3 uses UNICODE_FSS.

The SUBSTRING implementation for UNICODE_FSS (internal_fss_substring()) is 
straigthforward and logical - it skips POSITION characters
from the start of the source string first and then copy LENGTH chars into dest 
string.

The UTF8 implementation (MultiByteCharSet::substring()) convert whole source 
string into UTF16 and only then get substring of UTF16 string. 
This is simple but very inefficient especially for a long strings and small 
POSITION values.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6541) Restore backup on RawDevice (error during "open O_CREAT" operation for file "/dev/sda1")

2021-04-16 Thread Sascha Michel (JIRA)
Restore backup on RawDevice  (error during "open O_CREAT" operation for file 
"/dev/sda1")
-

 Key: CORE-6541
 URL: http://tracker.firebirdsql.org/browse/CORE-6541
 Project: Firebird Core
  Issue Type: Bug
  Components: GBAK
Affects Versions: 4.0 RC 1, 3.0.7
 Environment: Ubuntu 20.04 x86_64 GNU/Linux
Reporter: Sascha Michel


My blockdevice
root@U2004Firebird4Test:~# ls -lh /dev/sda1
brw-rw 1 firebird firebird 8, 0 Apr 15 20:53 /dev/sda1

root@U2004Firebird4Test:~# time /opt/firebird/bin/gbak -C  -user sysdba -pas 
'XXX'/DB/MATest.fbk  /dev/sda1
gbak: ERROR:I/O error during "open O_CREAT" operation for file "/dev/sda1"  
< why error on open/create File ??
gbak: ERROR:Error while trying to create file
gbak: ERROR:Device or resource busy
gbak: ERROR:failed to create database /dev/sda1
gbak:Exiting before completion due to errors


brw-rw 1 firebird firebird 8, 0 Apr 15 20:53 /dev/sda1
root@U2004Firebird4Test:~# time dd if=/dev/zero of=/dev/sda1 bs=32k count=1000 
oflag=sync
1000+0 records in
1000+0 records out
32768000 bytes (33 MB, 31 MiB) copied, 0.154765 s, 212 MB/s

I have not found any other syntax for "raw devices", is there something 
new/different here ?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6540) A way for a replication plugin to refuse attachment

2021-04-15 Thread Dimitry Sibiryakov (JIRA)
A way for a replication plugin to refuse attachment
---

 Key: CORE-6540
 URL: http://tracker.firebirdsql.org/browse/CORE-6540
 Project: Firebird Core
  Issue Type: Improvement
  Components: API / Client Library
Affects Versions: 4.0 RC 1
Reporter: Dimitry Sibiryakov


If it is not too late the signature of IReplicatedSession::setAttachment() 
should be changed to "bool setAttachment(Status status, Attachment attachment)" 
to let replication plugin refuse replication of this attachment for any reason 
(configuration option, "bad" user name, etc) with an optional error message.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6539) Replication plugin can crash engine returning nullptr from startTransaction() method

2021-04-15 Thread Dimitry Sibiryakov (JIRA)
Replication plugin can crash engine returning nullptr from startTransaction() 
method


 Key: CORE-6539
 URL: http://tracker.firebirdsql.org/browse/CORE-6539
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
Reporter: Dimitry Sibiryakov


If a plugin return nullptr from startTransaction() and no error in status (for 
example it decided that this transaction must not be replicated for any valid 
reason) Firebird engine will crash trying to call 
transaction->tra_replicator->startSavepoint().

IMHO such situation must be handled gracefully by disabling replication of this 
transaction.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6538) Add support for Package Body Constants (or even Variables)

2021-04-15 Thread Anderson Farias (JIRA)
Add support for Package Body Constants (or even Variables)
--

 Key: CORE-6538
 URL: http://tracker.firebirdsql.org/browse/CORE-6538
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Reporter: Anderson Farias
Priority: Minor


It would be nice to declare CONSTANTS in package body (or even variables) that 
could be used by all functions/procedues with in it. Eg.

RECREATE PACKAGE BODY MY_PACKAGE
AS
  DECLARE MY_CONSTANT VARCHAR(10) = 'SOME VALUE';
BEGIN

  FUNCTION MY_FUNCTION_A RETURNS VARCHAR(10)
  AS
  BEGIN
  RETURN  MY_CONSTANT;
  END

  FUNCTION MY_FUNCTION_B RETURNS VARCHAR(50)
  AS
  DECLARE MY_LOCAL_VAR VARCHAR(20);
  BEGIN
  MY_LOCAL_VAR = 'OTHER VALUE';
  RETURN  MY_CONSTANT || MY_LOCAL_VAR;
  END

(...)



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6537) Supported replication protocol(s)

2021-04-09 Thread Dimitry Sibiryakov (JIRA)
Supported replication protocol(s)
-

 Key: CORE-6537
 URL: http://tracker.firebirdsql.org/browse/CORE-6537
 Project: Firebird Core
  Issue Type: Improvement
  Components: API / Client Library
Affects Versions: 4.0 RC 1
Reporter: Dimitry Sibiryakov


It would be good to have a way to find out which protocols (block formats) are 
supported by IReplicator interface.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Reopened: (CORE-6015) Segfault when using expression index with complex expression

2021-04-09 Thread Alexander Peshkov (JIRA)


 [ 
http://tracker.firebirdsql.org/browse/CORE-6015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Peshkov reopened CORE-6015:
-


> Segfault when using expression index with complex expression
> 
>
> Key: CORE-6015
> URL: http://tracker.firebirdsql.org/browse/CORE-6015
> Project: Firebird Core
>  Issue Type: Bug
>Affects Versions: 2.5.0, 2.5.1, 2.5.2, 2.5.2 Update 1, 2.5.3, 2.1.7, 2.5.3 
> Update 1, 2.5.4, 2.5.5, 4.0 Initial, 3.0.0, 2.5.6, 3.0.1, 2.5.7, 3.0.2, 4.0 
> Alpha 1, 2.5.8, 3.0.3, 3.0.4, 4.0 Beta 1
>Reporter: Alexander Peshkov
>Assignee: Alexander Peshkov
> Fix For: 4.0 Beta 2, 3.0.5, 2.5.9
>
>
> Nothing limits use of rather complex expression in the index. One can use 
> selectable stored procedure to calculate that expression, and in that stored 
> procedure one can select rows from the table on which expression index is 
> created. During garbage collection of such index key value is calculated 
> which causes expression evaluation, execution of SP and tabke scan - which in 
> turn causes GC. I.e. we have unlimited recursion with obvious stack overflow 
> and segfault.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6536) The Large SQL crashes Firebird Server

2021-04-09 Thread Vadim Mescheryakov (JIRA)
The Large SQL crashes Firebird Server  
---

 Key: CORE-6536
 URL: http://tracker.firebirdsql.org/browse/CORE-6536
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.7, 3.0.1
 Environment: Windows 64 Bit
Reporter: Vadim Mescheryakov


The Large SQL with 1 OR operators and the size above 137 kb crashes 
Firebird Server 3.0.1 and 3.0.7.33374_1.
The Firebird Server version 2.5 shows only this error 
"Unsuccessful execution caused by an unavailable resource.
Implementation limit exceeded.
block size exceeds implementation restriction." and it stills working

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6535) View can not be subject of DML if it is declared WITH CHECK OPTION and COMPUTED-BY column present in the this view expression

2021-04-06 Thread Pavel Zotov (JIRA)
View can not be subject of DML if it is declared WITH CHECK OPTION and 
COMPUTED-BY column present in the this view expression
-

 Key: CORE-6535
 URL: http://tracker.firebirdsql.org/browse/CORE-6535
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Reporter: Pavel Zotov
Priority: Minor


Consider script:
===
shell del C:\temp\tmp.fdb 2>nul;
create database 'localhost:C:\temp\tmp.fdb';

recreate table test_nums(
id int generated by default as identity primary key
,n1 int
,n2 int
,calc_n1_n2_sum computed by( n1 + n2 )
);

recreate view v_check_sum_of_normal_columns as select n1,n2 from test_nums 
where n1 + n2 = 5
with check option
;

recreate view v_check_value_of_computed_col as select n1,n2 from test_nums 
where calc_n1_n2_sum = 5
with check option
;

recreate view v_check_of_mixed_columns_sum as select n1,n2 from test_nums where 
n1 < calc_n1_n2_sum
with check option
;
 
commit;

set echo on;

insert into v_check_sum_of_normal_columns(n1, n2) values(2, 3);

insert into v_check_value_of_computed_col(n1, n2) values(2, 3);

insert into v_check_of_mixed_columns_sum(n1, n2) values(2, 3);
===


Its output will be:
===
insert into v_check_sum_of_normal_columns(n1, n2) values(2, 3);

insert into v_check_value_of_computed_col(n1, n2) values(2, 3);
Statement failed, SQLSTATE = 23000
Operation violates CHECK constraint  on view or table 
V_CHECK_VALUE_OF_COMPUTED_COL
-At trigger 'CHECK_4'

insert into v_check_of_mixed_columns_sum(n1, n2) values(2, 3);
Statement failed, SQLSTATE = 23000
Operation violates CHECK constraint  on view or table 
V_CHECK_OF_MIXED_COLUMNS_SUM
-At trigger 'CHECK_6'
===

Checked on WI-V4.0.0.2406; WI-V3.0.8.33435.

PS.
I could not find apropriate info in SQL:2011 about this case. Perhaps this is 
not a bug, so I've set priority to minor.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6534) Hash join cannot match records using some TIME ZONE / DECFLOAT keys

2021-04-06 Thread Dmitry Yemanov (JIRA)
Hash join cannot match records using some TIME ZONE / DECFLOAT keys
---

 Key: CORE-6534
 URL: http://tracker.firebirdsql.org/browse/CORE-6534
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 4.0 Beta 2
Reporter: Dmitry Yemanov


Test case:

select 1 from rdb$database where timestamp '01.01.2021 13:00:00 +03:00' = 
timestamp '01.01.2021 12:00:00 +02:00';
-- Values are surely equal:

CONSTANT 
 
   1 

select 1 from (select timestamp '01.01.2021 13:00:00 +03:00' as ts from 
rdb$database) natural join (select timestamp '01.01.2021 12:00:00 +02:00' as ts 
from rdb$database);
-- OOPS! No record is returned!

select 1 from rdb$database where cast(10 as decfloat) = cast(10.000 as 
decfloat);
-- Values are surely equal:

CONSTANT 
 
   1 

select 1 from (select cast(10 as decfloat) as df from rdb$database) natural 
join (select cast(10.000 as decfloat) as df from rdb$database);
-- OOPS! No record is returned!

select 1 from rdb$database where cast('+0' as decfloat) = cast('-0' as 
decfloat);
-- Values are surely equal:

CONSTANT 
 
   1 

select 1 from (select cast('+0' as decfloat) as df from rdb$database) natural 
join (select cast('-0' as decfloat) as df from rdb$database);
-- OOPS! No record is returned!

And also another case with approximate zeros (similar to CORE-3547):

select 1 from rdb$database where cast('+0' as float) = cast('-0' as float);
-- Values are surely equal:

CONSTANT 
 
   1 

select 1 from (select cast('+0' as float) as f from rdb$database) natural join 
(select cast('-0' as float) as f from rdb$database);
-- OOPS! No record is returned!

select 1 from rdb$database where cast('+0' as double precision) = cast('-0' as 
double precision);
-- Values are surely equal:

CONSTANT 
 
   1 

select 1 from (select cast('+0' as double precision) as d from rdb$database) 
natural join (select cast('-0' as double precision) as d from rdb$database);
-- OOPS! No record is returned!


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6533) In Firebird 4 RC1 Round () does not round up more to decimal numbers

2021-04-03 Thread Sergio Cavicchioli (JIRA)
In Firebird 4 RC1 Round () does not round up more to decimal numbers 
-

 Key: CORE-6533
 URL: http://tracker.firebirdsql.org/browse/CORE-6533
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: Ubuntu 20.04.2 LTS - 
Firebird-4.0.0.2353-ReleaseCandidate1.amd64
Reporter: Sergio Cavicchioli


Hi
The Round function of a Double Precision field does not round more at decimal 
numbers but only to integers
No longer behaves like in Firebird 3 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6532) Results of сoncatenation with blob has no info about collation of source columns (which are declared with such info)

2021-04-02 Thread Pavel Zotov (JIRA)
Results of сoncatenation with blob has no info about collation of source 
columns (which are declared with such info)


 Key: CORE-6532
 URL: http://tracker.firebirdsql.org/browse/CORE-6532
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Pavel Zotov


set bail on;
set list on;

shell del c:\temp\tmp.fdb 2>nul;
create database 'localhost:c:\temp\tmp.fdb';

create collation name_coll for utf8 from unicode case insensitive;
commit;

--create domain dm_name_ci as varchar(10) character set utf8 collate name_coll;
create domain dm_name_ci as blob sub_type text character set utf8 collate 
name_coll;
commit;

recreate table test(
id int
   ,c1 varchar(10) character set utf8 collate name_coll
   ,b1 dm_name_ci
   --,b1 blob sub_type text character set utf8 collate name_coll -- same result
);

insert into test(id, c1, b1) values(1,'qWE','qWE');
insert into test(id, c1, b1) values(2,'QWe','QWe');
insert into test(id, c1, b1) values(3,'qwE','qwE');
commit;

set count on;
set echo on;

-

select id from test
where 
b1 starting with 'qwe' -- Records affected: 3 // OK
;


-

select id from test
where 
b1 || b1 starting with 'qwe' -- Records affected: 0
;



select id from test
where 
c1 || cast(c1 as blob sub_type text character set utf8) collate name_coll 
starting with 'qwe' -- Records affected: 0
;
-

set sqlda_display on;

select
b1
   ,b1 || b1 as "b1 || b1"
   ,c1 || cast(c1 as blob sub_type text character set utf8) collate name_coll  
as "c1 || cast(c1 as blob)"
from test t rows 0;


set sqlda_display off;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6531) COMPUTED BY column looses charset and collate of source field when is either of type BLOB or VARCHAR casted to BLOB

2021-04-02 Thread Pavel Zotov (JIRA)
COMPUTED BY column looses charset and collate of source field  when  is 
either of type BLOB or VARCHAR casted to BLOB
---

 Key: CORE-6531
 URL: http://tracker.firebirdsql.org/browse/CORE-6531
 Project: Firebird Core
  Issue Type: Bug
  Components: Charsets/Collation, Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Pavel Zotov


set bail on;
set list on;

shell del c:\temp\tmp.fdb 2>nul;
create database 'localhost:c:\temp\tmp.fdb';

create collation name_coll for utf8 from unicode case insensitive;
commit;

create domain dm_name_ci as blob sub_type text character set utf8 collate 
name_coll;
commit;

recreate table test(
id int
   ,b1 dm_name_ci
   ,calc_b1 computed by ( b1 )
   -
   ,c1 varchar(10) character set utf8 collate name_coll
   ,calc_c1 computed by ( cast(c1 as blob sub_type text character set utf8) 
collate name_coll ) -- ==> SQLDA: "charset: 0 NONE"
   --,calc_c1 computed by ( (select list(x.c1) from test x where x.id = 
test.id) ) -- ==> SQLDA: "charset: 0 NONE"
   --,calc_c1 computed by ( cast(c1 as varchar(10) character set utf8) collate 
name_coll ) -- ==> SQLDA: "charset: 32260 UTF8" // OK
);

insert into test(id, b1, c1) values(1,'qWE','qWE');
insert into test(id, b1, c1) values(2,'QWe','QWe');
insert into test(id, b1, c1) values(3,'qwE','qwE');
commit;

set count on;
set echo on;

-

select id
from test where calc_c1 starting with 'qwe'; -- Records affected: 0

-

select id
from test where calc_b1 starting with 'qwe'; -- Records affected: 0

-

set sqlda_display on;

select t.b1, t.c1 from test t rows 0;

select t.calc_b1, t.calc_c1 from test t rows 0;
set sqlda_display off;


Outcome:


select id
from test where calc_c1 starting with 'qwe'; -- Records affected: 0
Records affected: 0
-
select id
from test where calc_b1 starting with 'qwe'; -- Records affected: 0
Records affected: 0
-

set sqlda_display on;

select t.b1, t.c1 from test t rows 0;

INPUT message field count: 0

OUTPUT message field count: 2
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
  :  name: B1  alias: B1
  : table: TEST  owner: SYSDBA
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 40 charset: 32260 
UTF8
  :  name: C1  alias: C1
  : table: TEST  owner: SYSDBA
Records affected: 0



select t.calc_b1, t.calc_c1 from test t rows 0;

INPUT message field count: 0

OUTPUT message field count: 2
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 0 NONE
  :  name: CALC_B1  alias: CALC_B1
  : table: TEST  owner: SYSDBA
02: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 0 NONE
  :  name: CALC_C1  alias: CALC_C1
  : table: TEST  owner: SYSDBA
Records affected: 0
set sqlda_display off;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6528) Connect to database that contains broken pages can lead to FB crash

2021-03-30 Thread Pavel Zotov (JIRA)
Connect to database that contains broken pages can lead to FB crash
---

 Key: CORE-6528
 URL: http://tracker.firebirdsql.org/browse/CORE-6528
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Reporter: Pavel Zotov
 Attachments: broken.fdb.7z, dump-when-connect-to-broken-DB.7z, 
stack-trace-when-connect-to-broken-DB.7z

Attached .7z files can illustrate the problem:
1) broken.fdb.7z - database which has some pages with arbitrary typed 
characters (near the beginning of file);
2) stack-trace-when-connect-to-broken-DB.7z  and 
dump-when-connect-to-broken-DB.7z  -- stack trace and  dump when trying to 
connect to this DB (checked on LI-V4.0.0.2394)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6527) Regression: inline comment of SP parameter with closing parenthesis leads to incorrect SQL when trying to extract metadata

2021-03-28 Thread Pavel Zotov (JIRA)
Regression: inline comment of SP parameter with closing parenthesis leads to 
incorrect SQL when trying to extract metadata
--

 Key: CORE-6527
 URL: http://tracker.firebirdsql.org/browse/CORE-6527
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine, ISQL
Reporter: Pavel Zotov


Consider script and note on inline comment for 2nd input arg:  "-- (for 
invoices)":
=
shell if exist c:\temp\tmp4test.fdb del c:\temp\tmp4test.fdb;
create database 'localhost:c:\temp\tmp4test.fdb';

set term ^;
create or alter procedure sp_foo(
a_base_doc_id int,
a_base_doc_oper_id int default null -- (for invoices)
)
as
declare v_info varchar(100);
begin

v_info = 'base_doc='||a_base_doc_id;
end
^
set term ;^
commit;
show version;
=

If we then extract metadata from this DB then:

1) on 4.0.0.2353 generated SQL will be OK:
=
/* Stored procedures headers */
CREATE OR ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null)
AS 
BEGIN EXIT; END ^
. . .
ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null)
AS 
declare v_info varchar(100);
begin

v_info = 'base_doc='||a_base_doc_id;
end ^
=
(OK; though we do not see any original comments to input parameters, but this 
code can be compiled)


2) on 4.0.0.2365 extracted SQL for metadata will be incorrect:
=
CREATE OR ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null -- (for invoices))
AS 
BEGIN EXIT; END ^
. . .
ALTER PROCEDURE SP_FOO (A_BASE_DOC_ID INTEGER,
A_BASE_DOC_OPER_ID INTEGER default null -- (for invoices))
AS 
declare v_info varchar(100);
begin

v_info = 'base_doc='||a_base_doc_id;
end ^
=
(because inline comment with closing parenthesis is included here and this 
parenthesis is commented out, so this code can not be compiled.)

PS
The same for builds 3.0.7.33388 (it generates correct SQL) and  3.0.8.33415 
(generated metadata SQL is incorrect with the same problem)

Perhaps, this occurs because of fixes in CORE-6466, dated 04-feb-2021:
https://github.com/FirebirdSQL/firebird/commit/a8e63099fced66e6e17333a269435c6f54d87983
and 
https://github.com/FirebirdSQL/firebird/commit/32e74743f84d4f37c81ff31d6ae8431f7676cdbd



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6526) AV in engine when StatementTimeout is active for user statement and some internal DSQL statement was executed as part of overall execution process

2021-03-28 Thread Vlad Khorsun (JIRA)
AV in engine when StatementTimeout is active for user statement and some 
internal DSQL statement was executed as part of overall execution process
--

 Key: CORE-6526
 URL: http://tracker.firebirdsql.org/browse/CORE-6526
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 4.0 Beta 2, 4.0 Beta 1
Reporter: Vlad Khorsun


In the case below the internal DSQL statement is run on commit when index is 
modified.
Note, most internal statements used by the engine is ESQL, not DSQL - thus they 
are not interact with StatementTImeout.


set term ^;

execute block as begin
  in autonomous transaction do
 execute statement 'set statistics index rdb$index_0';
end
^
set statement timeout 60
^
execute block as begin
  in autonomous transaction do
 execute statement 'set statistics index rdb$index_0';
end
^

Statement failed, SQLSTATE = 08006
Error reading data from the connection.


The bug was reported by Pavel Zotov with much more complex scenario.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6525) segfaults in fbclient

2021-03-26 Thread Alexander Peshkov (JIRA)
segfaults in fbclient
-

 Key: CORE-6525
 URL: http://tracker.firebirdsql.org/browse/CORE-6525
 Project: Firebird Core
  Issue Type: Sub-task
  Components: API / Client Library
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Alexander Peshkov


Des

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6524) Various segfaults in fbclient

2021-03-26 Thread Alexander Peshkov (JIRA)
Various segfaults in fbclient
-

 Key: CORE-6524
 URL: http://tracker.firebirdsql.org/browse/CORE-6524
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Alexander Peshkov


This security-sensitive bug was reported to me privately, and I see no use in 
making it publicly known before release of fixed version and giving people time 
to upgrade. Details as always in restricted access.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6523) Bedpari Escort Bangalore

2021-03-25 Thread Bed Pari (JIRA)
Bedpari Escort Bangalore


 Key: CORE-6523
 URL: http://tracker.firebirdsql.org/browse/CORE-6523
 Project: Firebird Core
  Issue Type: Bug
Reporter: Bed Pari


08423121936 Bangalore Escorts provides escort call girls by the Bed Pari escort 
agency. We have selected the best high profile call girls in Bangalore.
https://www.bedpari.com/bangalore-escorts.html
https://www.whollymodels.com/bangalore-escorts.php
https://nikithabangaloreescorts.com/
https://www.divyagoal.com/
https://www.deepikarai.com/bangalore-escorts.php
https://bangalorevipmodels.com/
http://jiyajoshi.com/
https://www.bedpari.com/services.html
https://www.bedpari.com/indira-nagar.html
https://www.bedpari.com/jp-nagar.html
https://www.bedpari.com/vijay-nagar.html
https://www.bedpari.com/koramangala.html
https://www.bedpari.com/whitefield-bangalore.html
https://www.bedpari.com/escorts-services-mg-road.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6521) CAST of Infinity values to FLOAT doesn't work

2021-03-24 Thread Lukas Eder (JIRA)
CAST of Infinity values to FLOAT doesn't work
-

 Key: CORE-6521
 URL: http://tracker.firebirdsql.org/browse/CORE-6521
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7
Reporter: Lukas Eder


According to the docs:
https://firebirdsql.org/refdocs/langrefupd25-intfunc-log.html

This is how NaN, +Infinity, and -Infinity values of type DOUBLE PRECISION are 
created:

select log(1, 1), log(1, 0.5), log(1, 1.5) from RDB$DATABASE

It's possible to get a NaN value of type FLOAT:

select cast(log(1, 1) as float) from RDB$DATABASE

But infinities cannot be cast to FLOAT:

select cast(log(1, 1.5) as float) from RDB$DATABASE

This is producing an error:

> SQL Error [335544916] [22003]: arithmetic exception, numeric overflow, or 
> string truncation; numeric value is out of range [SQLState:22003, ISC error 
> code:335544916]

See also this Stack Overflow question:
https://stackoverflow.com/q/66763171/521799

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6520) Invalid time zone (+08). Falling back to displacement

2021-03-22 Thread Basil A. Sidorov (JIRA)
Invalid time zone (+08). Falling back to displacement
-

 Key: CORE-6520
 URL: http://tracker.firebirdsql.org/browse/CORE-6520
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: LI-V4.0.0.2390 Firebird 4.0 Release Candidate 1
Reporter: Basil A. Sidorov
Priority: Minor


CentOS Linux release 7.9.2009 (Core)
LI-V4.0.0.2390 Firebird 4.0 Release Candidate 1
--
ls -lhF /opt/firebird/tzdata/
total 244K
-r--r--r--. 1 root root  41K Mar 22 09:32 metaZones.res
-r--r--r--. 1 root root  20K Mar 22 09:32 timezoneTypes.res
-r--r--r--. 1 root root  23K Mar 22 09:32 windowsZones.res
-r--r--r--. 1 root root 153K Mar 22 09:32 zoneinfo64.res
--
timedatectl status
  Local time: Mon 2021-03-22 17:04:57 +08
  Universal time: Mon 2021-03-22 09:04:57 UTC
RTC time: Mon 2021-03-22 09:04:57
   Time zone: Asia/Irkutsk (+08, +0800)
 NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
  DST active: n/a

firebird.log:
--
vm-centos-7.local   Mon Mar 22 17:05:23 2021
/opt/firebird/bin/fbguard: guardian starting /opt/firebird/bin/firebird

vm-centos-7.local   Mon Mar 22 17:05:23 2021
Invalid time zone (+08). Falling back to displacement.
--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6519) Freeing a statement using DSQL_drop or DSQL_unprepare should send free packet immediately

2021-03-20 Thread Mark Rotteveel (JIRA)
Freeing a statement using DSQL_drop or DSQL_unprepare should send free packet 
immediately
-

 Key: CORE-6519
 URL: http://tracker.firebirdsql.org/browse/CORE-6519
 Project: Firebird Core
  Issue Type: Improvement
  Components: API / Client Library
Affects Versions: 4.0 RC 1, 3.0.7, 2.5.9
Reporter: Mark Rotteveel


Since the v11 protocol, fbclient will defer sending the free packet for 
op_free_statement until other activity on the connection. This approach can 
lead to issues when there is no further activity on the connection for a while, 
because the statement is not unprepared or dropped server-side, leading to 
Firebird holding on the metadata object locks for longer than necessary, which 
for example can prevent subsequent DDL on another connection to succeed. This 
can cause either transactions waiting for the lock to be released or errors 
like "unsuccessful metadata update; object TABLE "TEST" is in use 
[SQLState:42000, ISC error code:335544351]"

I propose that for DSQL_drop and DSQL_unprepare, the free packet is sent 
immediately, but processing of the response is deferred until later. For 
DSQL_close the current behaviour is not very problematic, so could remain as 
is. On firebird-devel, Vlad suggested an alternative approach to use a timer to 
send deferred packets with a delay so that multiple subsequent closes can be 
sent together.

See also JDBC-638 and 
https://groups.google.com/g/firebird-java/c/DuIRTYJru7U/m/cxxv49RGAgAJ and the 
discussion on firebird-devel titled "Does deferred processing of DSQL_drop and 
DSQL_unprepare make sense?"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6518) Wrong message when connecting to tiny trash database file

2021-03-18 Thread Alexander Peshkov (JIRA)
Wrong message when connecting to tiny trash database file
-

 Key: CORE-6518
 URL: http://tracker.firebirdsql.org/browse/CORE-6518
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
 Environment: posix
Reporter: Alexander Peshkov


When connecting to tiny DB file which is missing some pages in the end firebird 
produces various diags (depending upon what garbage it'a using instead missing 
page), for example:
Missing crypt plugin, but page appears encrypted


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6517) Regression: CREATE DATABASE fails with 'Token unknown' error when DB name is enclosed in double quotes and 'DEFAULT CHARACTER SET' is specified after

2021-03-17 Thread Pavel Zotov (JIRA)
Regression: CREATE DATABASE fails with 'Token unknown' error when DB name is 
enclosed in double quotes and 'DEFAULT CHARACTER SET' is specified after DB name
-

 Key: CORE-6517
 URL: http://tracker.firebirdsql.org/browse/CORE-6517
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Pavel Zotov
Priority: Trivial


Script (CAUTION: do not keep any sensitive databases in C:\temp\, it can drop 
some of them!)
===
shell del c:\temp\1*.fdb 2>nul;

set list on;
set echo on;

create database "c:\temp\111.fdb" page_size 8192;
select mon$database_name as test_name_2 from mon$database;
commit;

create database "c:\temp\112.fdb" default character set utf8;
select mon$database_name as test_name_2 from mon$database;
commit;

show version;
===

Output on 2.5.9.27152:
===
TEST_NAME_1 C:\TEMP\111.FDB
TEST_NAME_2 C:\TEMP\112.FDB
===

Output on 3.0.8.33426 and 4.0.0.2387:
===
TEST_NAME_1 C:\TEMP\111.FDB
. . .
create database "c:\temp\112.fdb" default character set utf8;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 17
-"c:\temp\112.fdb"
===


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6516) Protect included tomcrypt library from being overwritten by system package

2021-03-16 Thread Alexander Peshkov (JIRA)
Protect included tomcrypt library from being overwritten by system package
--

 Key: CORE-6516
 URL: http://tracker.firebirdsql.org/browse/CORE-6516
 Project: Firebird Core
  Issue Type: Bug
  Components: Installation
 Environment: linux
Reporter: Alexander Peshkov


Tomcrypt library has a kind of "unstable" API. Default built of it does not 
include thread safety option - i.e. some global data structures are not 
protected by mutex. That's not good for us itself but what is worse - if 
firebird binary expects shared tomcrypt library built with thread safety ON but 
actually it was built (by third-party) with  OFF different size of data 
structures in API calls causes segfault when working (for example) with PRNGs.
Therefore we include tomcrypt library in 'universal' binaries for linux but it 
can be easily overwritten with system package. Problematic library should be 
placed in a way that it will be always used by our binaries instead system one.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6515) Please allow collation sequence clause in CREATE/ALTER DATABASE statement

2021-03-15 Thread An Pham (JIRA)
Please allow collation sequence clause in CREATE/ALTER DATABASE statement
-

 Key: CORE-6515
 URL: http://tracker.firebirdsql.org/browse/CORE-6515
 Project: Firebird Core
  Issue Type: Improvement
  Components: Charsets/Collation
Affects Versions: 4.0 RC 1
Reporter: An Pham


Currently it is allow to specify character set but not collation for default 
database. This extension will match with MS SQL for easier to port application. 
The problem with domain is tied to specific length.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6514) "Macro substitution" can add more?

2021-03-11 Thread freeman35 (JIRA)
"Macro substitution" can add more?
--

 Key: CORE-6514
 URL: http://tracker.firebirdsql.org/browse/CORE-6514
 Project: Firebird Core
  Issue Type: New Feature
Reporter: freeman35


Hi,
In firebird.conf "Macro substitution" can add more?
dir_Pro_I  = C:\project\A_1
dir_Pro_II = C:\project\A_2
dir_Pro_IV=C:\project\A_4
etc
so can use in database.conf
my_db_I = $(dir_Pro_I)/pr_2021.fdb
my_db_II = $(dir_Pro_II)/pr_II_abc.fdb
regards

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6513) databases.conf line end of char need.

2021-03-11 Thread freeman35 (JIRA)
databases.conf line end of char need.
-

 Key: CORE-6513
 URL: http://tracker.firebirdsql.org/browse/CORE-6513
 Project: Firebird Core
  Issue Type: New Feature
Reporter: freeman35


Hi,
Ib databases.conf

#
# Live Databases:
#
my db II =  c:\_Datas\VII\MASTER_II.FRB {RemoteAccess = true 
DefaultDbCachePages = 256}
my db III = c:\_Datas\VII\mydb_III.FRB  {RemoteAccess = true 
DefaultDbCachePages = 256}

This style much more readable, but firebird has no char for on end of line for 
example ";" so get error.
can do this? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6512) DatabaseAccess = Restrict not working

2021-03-11 Thread freeman35 (JIRA)
DatabaseAccess = Restrict   not working
---

 Key: CORE-6512
 URL: http://tracker.firebirdsql.org/browse/CORE-6512
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1
Reporter: freeman35
Priority: Critical


Hi,
just try how its work, but its not work :)
In firebird.conf I activeted this line
DatabaseAccess = Restrict C:\DataBase

I have not this folder in my disk. my test db is in diffrent folder. But I can 
conneted to db ??
I this bug? 
I tested firebird 3.0.7 & firebird 4rc1 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6511) Allow parenthesized query expression for standard-compliance

2021-03-11 Thread Mark Rotteveel (JIRA)
Allow parenthesized query expression for standard-compliance


 Key: CORE-6511
 URL: http://tracker.firebirdsql.org/browse/CORE-6511
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Reporter: Mark Rotteveel
 Attachments: query-expr-v3.diff

See also discussion with subject "Standard-compliance for query expressions" on 
firebird-devel (March 6th, 2021).

The SQL standard allows parentheses around query expressions (without 
with-clause), and Firebird does not. It would be helpful if Firebird added this 
support.

Specifically, SQL:2016 specifies the following:

```
 ::=
  [  ] 
  [  ] [  ] [  ]

 ::=

  |  UNION [ ALL | DISTINCT ]
  [  ] 
  |  EXCEPT [ ALL | DISTINCT ]
  [  ] 

 ::=

  |  INTERSECT [ ALL | DISTINCT ]
  [  ] 

 ::=

  |  
  [  ] [  ] [  ]
  

 ::=

  | 
  | 

 ::=
  SELECT [  ]  

 ::=
  
[  ]
[  ]
[  ]
[  ]
```

If I follow the grammar in parse.y correctly, the problem is that in Firebird, 
 is basically , so it's missing the 
following alternative:

```
 
  [  ] [  ] [  ]
  
``` 

Adriano wrote the attached patch.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6510) Require exactly correct page size in DPB when creating database, reject wrong values

2021-03-09 Thread Alexander Peshkov (JIRA)
Require exactly correct page size in DPB when creating database, reject wrong 
values


 Key: CORE-6510
 URL: http://tracker.firebirdsql.org/browse/CORE-6510
 Project: Firebird Core
  Issue Type: Improvement
  Components: API / Client Library, Engine
Reporter: Alexander Peshkov
Priority: Minor


Currently FB accepts any numeric noise as valid page size, rounding it down (or 
up in case of small values) to the nearest correct page size. That behavior 
appera s to be very suspicious - looks like it may cause only problems.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6509) Segfault when gfix requests for database page buffer more memory than available from OS

2021-03-09 Thread Alexander Peshkov (JIRA)
Segfault when gfix requests for database page buffer more memory than available 
from OS
---

 Key: CORE-6509
 URL: http://tracker.firebirdsql.org/browse/CORE-6509
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: linux
Reporter: Alexander Peshkov


gfix -buf {huge-value} any.fdb
cause segfault

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6508) CAST of floating point types yields unnecessary string truncation error and does not conform to SQL standard requirements

2021-03-08 Thread Mark Rotteveel (JIRA)
CAST of floating point types yields unnecessary string truncation error and 
does not conform to SQL standard requirements
-

 Key: CORE-6508
 URL: http://tracker.firebirdsql.org/browse/CORE-6508
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Mark Rotteveel


Attempts to cast floating point values to a string of a short length can result 
in errors like

"""
arithmetic exception, numeric overflow, or string truncation; string right 
truncation; expected length 5, actual 17
"""

For example

```
select cast(0e0 as varchar(5)) from rdb$database;
select cast(1e0 as varchar(5)) from rdb$database;
```

The problem is that Firebird renders the string as '0.000' or 
'1.000'. 

The SQL standard says on this subject in 6.13 :

"""
11) If TD is fixed-length character string, then let LTD be the length in 
characters of TD.
Case:
[...]
b) If SD is approximate numeric, then:
i) Let YP be a character string as follows.
Case:
1) If SV equals 0 (zero), then YP is '0E0'.
2) Otherwise, YP is the shortest character string that conforms to the 
definition of  in Subclause 5.3, "", 
whose interpreted value is equal to the absolute value of SV and whose 
 consists of a single  that is not '0' (zero), followed by a 
 and an .
ii) Case:
1) If SV is less than 0 (zero), then let Y be the result of '-' || YP.
2) Otherwise, let Y be YP.
[...]
"""
(and similar rules for variable-length character string or large object 
character string).

In other words, there are three problems here:
1) 0e0 should have produced the three character string '0e0', not 
0.000
2) The values produced are not "the shortest character string" (the crux of the 
problem here)
3) The values produced do not conform to the  as 
they do not include an E followed by the exponent nor do they follow the rule 
"[...] whose interpreted value is equal to the absolute value of SV and whose 
 consists of a single  that is not '0' (zero), followed by a 
 and an ."

For the last one, for example select `cast(10e0 as char(20)) from rdb$database` 
should produce the string '1.0e1' (or maybe '1e1', but that would not fullfil 
the " consists of a single  that is not '0' (zero), followed 
by a  and an " part of the rule.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6507) Implement SQL standard FORMAT clause for CAST between string types and datetime types

2021-03-08 Thread Mark Rotteveel (JIRA)
Implement SQL standard FORMAT clause for CAST between string types and datetime 
types
-

 Key: CORE-6507
 URL: http://tracker.firebirdsql.org/browse/CORE-6507
 Project: Firebird Core
  Issue Type: New Feature
  Components: Engine
Reporter: Mark Rotteveel


Implement SQL standard FORMAT clause for CAST between string types and datetime 
types, to allow custom formatting of datetime values and conversion from string 
values with a specific format to datetime values.

"""
 ::=
  CAST 
 AS 
[ FORMAT  ]


 ::=

  | 

 ::=

  | 

 ::=

"""

Where  follows the rules of Subclause 9.42, "Converting a 
datetime to a formatted character string" or Subclause 9.43, "Converting a 
formatted character string to a datetime". Specific syntax rules defined in 
Subclause 9.44, "Datetime templates":

"""
 ::=
{  }...

 ::=

  | 

 ::=

  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 

 ::=

  | 
  | 
  | 
  | 
  | 
  | 
  | 

 ::=
 | YYY | YY | Y

 ::=
 | RR

 ::=
MM

 ::=
DD

 ::=
DDD

 ::=
HH | HH12

 ::=
HH24

 ::=
MI

 ::=
SS

 ::=
S

 ::=
FF1 | FF2 | FF3 | FF4 | FF5 | FF6 | FF7 | FF8 | FF9

 ::=
A.M. | P.M.

 ::=
    TZH

 ::=
TZM
"""

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6506) Error in SELECT SUM () of a field of type DECIMAL (18, 6)

2021-03-07 Thread Sergio Cavicchioli (JIRA)
Error in SELECT SUM () of a field of type DECIMAL (18,6)


 Key: CORE-6506
 URL: http://tracker.firebirdsql.org/browse/CORE-6506
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: Ubuntu 20.04.2 LTS - 
Firebird-4.0.0.2353-ReleaseCandidate1.amd64
Reporter: Sergio Cavicchioli
Priority: Critical


Hi
I made a new VM with Ubuntu 20.04.2 LTS and installed Firebird4 RC1.
I made a backup of a production DB with Firebird3 and restored it in Firebird4.
While testing the program that uses it, I noticed an error.
The program was running a complex Query then minimized it until I found the 
error.
es. Select Sum(MyFieldName) As MyResult From MyTable
MyFieldName is of type DECIMAL(18.6)

i get this error:

Error: *** IBPP::LogicException ***
Context: RowImpl::AllocVariables
Message: Found an unknown sqltype !


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6505) ISQL is adding an unnecessary COMMIT WORK statement to the extracted metadata script before starting the Stored functions headers/bodies statements

2021-03-06 Thread Luciano Mendes (JIRA)
ISQL is adding an unnecessary COMMIT WORK statement to the extracted metadata 
script before starting the Stored functions headers/bodies statements
---

 Key: CORE-6505
 URL: http://tracker.firebirdsql.org/browse/CORE-6505
 Project: Firebird Core
  Issue Type: Bug
  Components: ISQL
Affects Versions: 3.0.8
 Environment: Windows 10 20H2
Firebird 3.0.8.33420
Reporter: Luciano Mendes
 Attachments: DDL.SQL

ACTUAL RESULT
- ISQL is adding an unnecessary COMMIT WORK statement to the extracted metadata 
script before starting the Stored functions headers/bodies statements (lines 4 
and 15 from DDL.SQL attached)

EXPECTEDT RESULT
- ISQL do not need to add an COMMIT WORK statement to the extracted metadata 
script before starting the Stored functions headers/bodies statements (lines 4 
and 15 from DDL.SQL attached)

STEPS TO REPRODUCE THIS ISSUE:
1- Create a new database and than just create a simple function:
SET TERM ^ ;
CREATE OR ALTER FUNCTION M_BINTODEC (BIN_NUMBER VARCHAR(63) CHARACTER SET 
WIN1252)
RETURNS BIGINT
AS
BEGIN END^
SET TERM ; ^

2- Extract the Metadata script using the ISQL.exe and check all the 
instructions (see lines 4 and 15 from DDL.SQL attached)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6504) Provide same results for date arithmetics when date is changed by values near +/-max(bigint)

2021-03-05 Thread Pavel Zotov (JIRA)
Provide same results for date arithmetics when date is changed by values near 
+/-max(bigint)


 Key: CORE-6504
 URL: http://tracker.firebirdsql.org/browse/CORE-6504
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Pavel Zotov
 Attachments: 
date-arithmetic-with-changing-date-for-power_2_63-days_-_overall-results-for-FB-3.x-and-4.x.xlsx

Ticked was created after discuss results of  test for CORE-624 with Alex and 
Vlad.

Following statements show different results on FB 3.x and 4.x when date is 
decremented by values = ~2^63.
See also attached .xlsx with overall results in one table.


Database and client dialect = 3.

###  A. DECREMENT date  ###


Linux

1) LI-V4.0.0.2379

echo "set heading off; select date '01.02.2020' + -9223372036854775807 from 
rdb\$database;" | /var/tmp/fb40tmp/bin/isql employee
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates


echo "set heading off; select date '01.02.2020' + -9223372036854775808 from 
rdb\$database;" | /var/tmp/fb40tmp/bin/isql employee
2020-02-01




2) LI-V3.0.8.33415

echo "set heading off; select date '01.02.2020' + -9223372036854775807 from 
rdb\$database;" | /var/tmp/fb30tmp/bin/isql employee -z
2020-02-02

echo "set heading off; select date '01.02.2020' + -9223372036854775808 from 
rdb\$database;" | /var/tmp/fb30tmp/bin/isql employee -z
2020-02-01


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Windows

1) WI-V4.0.0.2377

C:\FB\40SS>echo set heading off; select date '01.02.2020' - 
+9223372036854775807 from rdb$database; | isql employee
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates


C:\FB\40SS>echo set heading off; select date '01.02.2020' + 
-9223372036854775808 from rdb$database; | isql /:employee
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates




2) WI-V3.0.8.33423

C:\FB\30SS>echo set heading off; select date '01.02.2020' - 
-9223372036854775807 from rdb$database; | isql employee  -z
2020-01-31

SQL>
C:\FB\30SS>echo set heading off; select date '01.02.2020' - 
-9223372036854775808 from rdb$database; | isql employee  -z
2020-02-01



### B. INCREMENT date ###


Linux

1)build LI-V4.0.0.2379

echo "set heading off; select date '01.02.2020' + 9223372036854775807 from 
rdb\$database;" | /var/tmp/fb40tmp/bin/isql employee -z
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates


echo "set heading off; select date '01.02.2020' - (-9223372036854775808) from 
rdb\$database;" | /var/tmp/fb40tmp/bin/isql employee -z
2020-02-01



2) LI-V3.0.8.33415

echo "set heading off; select date '01.02.2020' + 9223372036854775807 from 
rdb\$database;" | /var/tmp/fb30tmp/bin/isql employee -z
2020-01-31


echo "set heading off; select date '01.02.2020' - (-9223372036854775808) from 
rdb\$database;" | /var/tmp/fb30tmp/bin/isql employee -z
2020-02-01


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Windows


1) WI-V4.0.0.2377

C:\FB\40SS>echo set heading off; select date '01.02.2020' + 9223372036854775807 
from rdb$database; | isql employee  -z
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates


C:\FB\40SS>echo set heading off; select date '01.02.2020' - 
(-9223372036854775808) from rdb$database; | isql employee  -z
Statement failed, SQLSTATE = 22008
value exceeds the range for valid dates


2) WI-V3.0.8.33423


C:\FB\30SS>echo set heading off; select date '01.02.2020' + 9223372036854775807 
from rdb$database; | isql employee  -z
2020-01-31

SQL>
C:\FB\30SS>echo set heading off; select date '01.02.2020' - 
(-9223372036854775808) from rdb$database; | isql employee  -z
2020-02-01


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6503) Attempt to create database with page_size >= 65536 leads to createing DB with actual page size = 4k or 8k, but not 32k as it would be

2021-03-05 Thread Pavel Zotov (JIRA)
Attempt to create database with page_size >= 65536 leads to createing DB with 
actual page size = 4k or 8k, but not 32k as it would be
-

 Key: CORE-6503
 URL: http://tracker.firebirdsql.org/browse/CORE-6503
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: Linux only. No problem on Windows
Reporter: Pavel Zotov
Priority: Minor


Ticker created after check results of test for CORE-6316 on Linux (discussed 
with Alex).

Following script illustrates the problem:

# echo "create database '/var/tmp/tmp_page_size_32k.fdb' page_size 32767; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_32k.fdb
PAGE_SIZE 16384
(OK, expected)

# echo "create database '/var/tmp/tmp_page_size_32k.fdb' page_size 32768; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_32k.fdb
PAGE_SIZE 32768
(OK, expected)

# echo "create database '/var/tmp/tmp_page_size_32k.fdb' page_size 32769; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_32k.fdb
PAGE_SIZE 32768
(OK, expected)

# echo "create database '/var/tmp/tmp_page_size_64k.fdb' page_size 65535; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_64k.fdb
PAGE_SIZE 32768
(OK, expected)



# echo "create database '/var/tmp/tmp_page_size_64k.fdb' page_size 65536; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_64k.fdb
PAGE_SIZE 8192

# echo "create database '/var/tmp/tmp_page_size_64k.fdb' page_size 65537; show 
database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i "page_size"
Database: /var/tmp/tmp_page_size_64k.fdb
PAGE_SIZE 4096

# echo "create database '/var/tmp/tmp_page_size_2gb.fdb' page_size 2147483648; 
show database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i 
"page_size"
Database: /var/tmp/tmp_page_size_2gb.fdb
PAGE_SIZE 8192

# echo "create database '/var/tmp/tmp_page_size_2gb.fdb' page_size 2147483649; 
show database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i 
"page_size"
Database: /var/tmp/tmp_page_size_2gb.fdb
PAGE_SIZE 4096

# echo "create database '/var/tmp/tmp_page_size_4gb.fdb' page_size 4294967296; 
show database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i 
"page_size"
Database: /var/tmp/tmp_page_size_4gb.fdb
PAGE_SIZE 8192

# echo "create database '/var/tmp/tmp_page_size_4gb.fdb' page_size 4294967297; 
show database; drop database;" | /var/tmp/fb40tmp/bin/isql -q | grep -i 
"page_size"
Database: /var/tmp/tmp_page_size_4gb.fdb
PAGE_SIZE 4096






-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6502) Stored procedure isn't able to execute statement 'GRANT'

2021-03-04 Thread Roman Simakov (JIRA)
Stored procedure isn't able to execute statement 'GRANT'


 Key: CORE-6502
 URL: http://tracker.firebirdsql.org/browse/CORE-6502
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1
Reporter: Roman Simakov


The engine executing GRANT from a stored procedure with SQL SECURITY DEFINER 
runned from another user with EXECUTE privilege raises the error "User cannot 
write to RDB$USER_PRIVILEGES"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6501) Segfault when shutting down database which got encrypted by another process

2021-03-03 Thread Alexander Peshkov (JIRA)
Segfault when shutting down database which got encrypted by another process
---

 Key: CORE-6501
 URL: http://tracker.firebirdsql.org/browse/CORE-6501
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7, 3.0.6, 4.0 Beta 2, 3.0.5, 4.0 Beta 1, 
3.0.4, 3.0.3, 4.0 Alpha 1, 3.0.2, 3.0.1, 3.0.0, 4.0 Initial
 Environment: Classic mode
Reporter: Alexander Peshkov


When database is shutting down header page should be fetched and next written 
to database in order to update transaction numbers. If AST, causing change of 
encryption state, arrived during DB shutdown right before TRA_update_counters() 
database encryption manager is already missing environment required to load 
encryption plugin (like attachment) and segfaults happens when plugin is tried 
to be loaded.

Update of DB header does not require presence of database crypt plugin - it's 
anyway not encrypted page. Therefore fix is ti check environment before attempt 
to load plugin.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6500) Trace: provide ability to see STATEMENT RESTART events (or their count)

2021-03-02 Thread Pavel Zotov (JIRA)
Trace: provide ability to see STATEMENT RESTART events (or their count)
---

 Key: CORE-6500
 URL: http://tracker.firebirdsql.org/browse/CORE-6500
 Project: Firebird Core
  Issue Type: Improvement
  Components: TRACEMGR
Reporter: Pavel Zotov
Priority: Minor


Ticket was created after discussion with Vlad.

When engine can not fetch any record for lock it starts undo, restores Tx level 
to RC READ CONSISTENCY and makes restart of top-level statement.
It will be useful to see this event in the trace log: either like " 
() EXECUTE_STATEMENT_RESTART"  or in statistics table.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6499) Regression: gstat with switch -t executed via services fails with "found unknown switch" error

2021-02-26 Thread Pavel Cisar (JIRA)
Regression: gstat with switch -t executed via services fails with "found 
unknown switch" error
--

 Key: CORE-6499
 URL: http://tracker.firebirdsql.org/browse/CORE-6499
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Pavel Cisar


Found via firebird-driver that uses new OO API. When gstat is executed via 
services, the -t  switch is passed via SPB tag COMMAND_LINE (105) 
followed by string containing '-t tablename'. This works just fine with 
firebird 3.0.5, 3.0.6 and 4.0 Beta 2, but fails on 3.0.7 and 4.0 RC1 with 
"found unknown switch" error message.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6498) Firebird server stops to listen to new connections after error in nbackup service

2021-02-25 Thread Alexander Peshkov (JIRA)
Firebird server stops to listen to new connections after error in nbackup 
service
-

 Key: CORE-6498
 URL: http://tracker.firebirdsql.org/browse/CORE-6498
 Project: Firebird Core
  Issue Type: Sub-task
  Components: NBACKUP
Affects Versions: 4.0 RC 1
 Environment: Linux (and other posix systems)
Reporter: Alexander Peshkov


After an error in nbackup service (see test for CORE-6319 to reproduce) server 
process continues running but does not listen on port 3050 any more.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6497) Fb4 RC1 synchronous replication to localhost hang on disconnect

2021-02-24 Thread Lucas Schatz (JIRA)
Fb4 RC1 synchronous replication to localhost hang on disconnect
---

 Key: CORE-6497
 URL: http://tracker.firebirdsql.org/browse/CORE-6497
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
 Environment: VM Centos 8 64bits, SELinux disabled  fresh install 1 
CPU, 2Gb RAM, 20Gb disk 
Reporter: Lucas Schatz


Steps to reproduce: 

replication.conf:
database = /db/primary.fdb
{
  sync_replica = SYSDBA:***@localhost:/db/replica.fdb
}

systemctl stop firebird
mkdir /db 
chown firebird. /db
rm /db/primary.fdb /db/replica.fdb -f
systemctl start firebird
echo "create database 'localhost:/db/primary.fdb';ALTER DATABASE ENABLE 
PUBLICATION; ALTER DATABASE INCLUDE ALL TO PUBLICATION;quit;" | 
/opt/firebird/bin/isql
systemctl stop firebird
cp -a primary.fdb replica.fdb
gfix -replica read_write /db/replica.fdb
systemctl start firebird
echo "show table;quit;" | /opt/firebird/bin/isql localhost:/db/primary.fdb
echo "show table;quit;" | /opt/firebird/bin/isql localhost:/db/replica.fdb
echo "create table tb1 (a integer not null, constraint tb1_pk primary key 
(a));commit;quit;" | /opt/firebird/bin/isql localhost:/db/primary.fdb #Here the 
script hang on the quit; command and I need to pkill -9 both isql and firebird
pkill -9 firebird; pkill -9 isql
echo "show table;quit;" | /opt/firebird/bin/isql localhost:/db/primary.fdb 
#Table is created
echo "show table;quit;" | /opt/firebird/bin/isql localhost:/db/replica.fdb 
#Table is replicated

No error in replication.log nor firebird.log 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6496) string_to_datetime and '\0' symbol

2021-02-24 Thread Kovalenko Dmitry (JIRA)
string_to_datetime and '\0' symbol
--

 Key: CORE-6496
 URL: http://tracker.firebirdsql.org/browse/CORE-6496
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.8
Reporter: Kovalenko Dmitry


string_to_datetime returns error when translates string like:

"2021-2-20\0"
"2021-2-20 1:2\0"
"2021-2-20 1:2:3\0"

but not have problems with translation of strings like:

"5.3.2021 01:02:03.1234\0"

-
Note that, Firebird can't translate to BOOLEAN the string with '\0' symbol (for 
example "TRUE\0").


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6495) string_to_datetime and y2k problem

2021-02-24 Thread Kovalenko Dmitry (JIRA)
string_to_datetime and y2k problem
--

 Key: CORE-6495
 URL: http://tracker.firebirdsql.org/browse/CORE-6495
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.8
Reporter: Kovalenko Dmitry
Priority: Minor


string_to_datetime has following code for correction of y2k problem (two-digit 
year):

tm times2;
Firebird::TimeStamp::getCurrentTimeStamp().decode();

// Handle defaulting of year

if (description[position_year] == 0) {
times.tm_year = times2.tm_year + 1900;
}
else if (description[position_year] <= 2)
{
// Handle conversion of 2-digit years
if (times.tm_year < (times2.tm_year - 50) % 100)
times.tm_year += 2000;
else
times.tm_year += 1900;
}

times.tm_year -= 1900;
times.tm_mon -= 1;

---
This code looks to the CURRENT year, but adjust the two-digit year number on 
1900 or 2000.

When current year will be more than 2050, this code will return strange result.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6494) Inconsistent translation "string->timestamp->string->timestamp" and first dialect

2021-02-24 Thread Kovalenko Dmitry (JIRA)
Inconsistent  translation "string->timestamp->string->timestamp" and first 
dialect
--

 Key: CORE-6494
 URL: http://tracker.firebirdsql.org/browse/CORE-6494
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.8
Reporter: Kovalenko Dmitry
Priority: Minor


Connection with first dialect.

SQL:
select cast(cast(cast(cast('2-DEC-0083' as TIMESTAMP) as varchar(64))as 
TIMESTAMP)as varchar(64))  from DUAL

RESULT:
2-DEC-1983

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6493) Connecting to DB with any user/password

2021-02-21 Thread Haik Hairapetyan (JIRA)
Connecting to DB with any user/password
---

 Key: CORE-6493
 URL: http://tracker.firebirdsql.org/browse/CORE-6493
 Project: Firebird Core
  Issue Type: Bug
  Components: Security
Affects Versions: 3.0.2
 Environment: CentOS Linux 6.9
Connecting via SSH with root access
Reporter: Haik Hairapetyan


In a newly created database, I don't get any error message when I connect to 
the DB with the wrong user and password (the users TTT and AAA don't even exist)

[root@fewww bin]# ./isql /opt/db/treewww/ftree.db -user ttt -password bbb;
Database: /opt/db/treewww/ftree.db, User: TTT
SQL> exit;
[root@fewww bin]# ./isql /opt/db/treewww/ftree.db -user aaa -password ccc;
Database: /opt/db/treewww/ftree.db, User: AAA
SQL> SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') from rdb$database;
RDB$GET_CONTEXT
===
3.0.2

At the same time, I get a 'regular' error message in another database when I 
try to connect the DB with the wrong credentials:

[root@fewww bin]# ./isql /opt/db/testwww/ftest.db -user aaa -password ddd
Statement failed, SQLSTATE = 08001
I/O error during "lock" operation for file "/opt/db/testwww/ftest.db"
-Database already opened with engine instance, incompatible with current
Use CONNECT or CREATE DATABASE to specify a database

Could you please explain the matter?
Thank you.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6492) Add TIME and TIMESTAMP to EXTRACT to be able to obtain UTC value of WITH TIME ZONE types.

2021-02-21 Thread Mark Rotteveel (JIRA)
Add TIME and TIMESTAMP to EXTRACT to be able to obtain UTC value of WITH TIME 
ZONE types.
-

 Key: CORE-6492
 URL: http://tracker.firebirdsql.org/browse/CORE-6492
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Affects Versions: 4.0 RC 1
Reporter: Mark Rotteveel


As a follow-up to the discussion on firebird-devel titled "Current timestamp 
without timezone in given timezone", I suggest that we add TIME and TIMESTAMP 
to EXTRACT to be able to extract the UTC value of a WITH TIME ZONE type as an 
WITHOUT TIME ZONE type.

This would have the following semantics:

 from  => 
TIME from timestamp_with_tz => UTC value as TIME WITHOUT TIME ZONE
TIMESTAMP from timetamp_with_tz => UTC value as TIMESTAMP WITHOUT TIME ZONE
TIME from time_with_tz => UTC value as TIME WITHOUT TIME ZONE
TIMESTAMP from timestamp_with_tz => UTC value @ current_date as TIMESTAMP 
WITHOUT TIME ZONE
TIME from timestamp_without_tz => cast to TIME WITHOUT TIME ZONE (strip date)
TIMESTAMP from timestamp_without_tz => original value (timestamp_without_tz )
TIME from time_without_tz => original value (time_without_tz)
TIMESTAMP from time_without_tz => cast to TIMESTAMP WITHOUT TIME ZONE (value @ 
current_date)
TIME from date_val => conversion error
TIMESTAMP from date_val => cast to TIMESTAMP WITHOUT TIME ZONE (current_date + 
00:00:00 as time)

This solution would be non-standard, but would provide a nice symmetry with 
EXTRACT(TIMEZONE_HOUR FROM ...) and EXTRACT(TIMEZONE_MINUTE FROM ...)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Reopened: (CORE-6487) FETCH ABSOLUTE and RELATIVE beyond bounds of cursor should always position immediately before-first or after-last

2021-02-17 Thread Mark Rotteveel (JIRA)


 [ 
http://tracker.firebirdsql.org/browse/CORE-6487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Rotteveel reopened CORE-6487:
--


I'm reopening the issue as it also needs to be backported.

> FETCH ABSOLUTE and RELATIVE beyond bounds of cursor should always position 
> immediately before-first or after-last
> -
>
> Key: CORE-6487
> URL: http://tracker.firebirdsql.org/browse/CORE-6487
> Project: Firebird Core
>  Issue Type: Bug
>Affects Versions: 3.0.7, 4.0 RC 1
>Reporter: Mark Rotteveel
>Assignee: Dmitry Yemanov
> Fix For: 4.0.0
>
>
> With FETCH ABSOLUTE n and FETCH RELATIVE n, it is possible to position the 
> cursor beyond the bounds of the result set. Currently the actual position is 
> remembered, and this has unexpected effects on subsequent use of FETCH 
> RELATIVE n: The offset (n) used must be large enough the position the cursor 
> back within bounds.
> For example 
> execute block
>   returns (rowval integer, rowcount integer)
> as
>   declare c scroll cursor for (select 1 as rowval from rdb$database union all 
> select 2 as rowval from rdb$database union all select 3 as rowval from 
> rdb$database);
> begin
>open c;
> fetch absolute 5 from c;
> -- fetch relative -1 from c;
> -- fetch prior from c;
> fetch relative -2 from c;
> rowval = c.rowval;
> rowcount = row_count;
> suspend;
> end 
> The FETCH ABSOLUTE 5 positions the cursor two rows beyond the last row. Using 
> FETCH RELATIVE -2 or FETCH PRIOR will return the last row, while FETCH 
> RELATIVE -1 is not sufficient.
> For consistent behaviour (i.e. FETCH NEXT and FETCH RELATIVE 1, and FETCH 
> PRIOR and FETCH RELATIVE -1 behaving identical), it would be better that any 
> move out of bounds of the result set, will position the cursor immediately 
> before the first row (position = 0) or immediately after the last row 
> (position = last + 1). This would also match the behaviour specified in ODBC 
> for SQLFetchScroll(), and in JDBC for ResultSet.absolute(int) and 
> ResultSet.relative(int)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6490) Wrong error message when executing ALTER ROLE without ALTER ANY ROLE

2021-02-16 Thread Mark Rotteveel (JIRA)
Wrong error message when executing ALTER ROLE without ALTER ANY ROLE


 Key: CORE-6490
 URL: http://tracker.firebirdsql.org/browse/CORE-6490
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Mark Rotteveel


A user executing ALTER ROLE without ALTER ANY ROLE privilege is shown the wrong 
error message.

Current behaviour:

```
alter role rdb$admin set auto admin mapping;
Statement failed, SQLSTATE = 28000
unsuccessful metadata update
-CREATE OR ALTER MAPPING AutoAdminImplementationMapping failed
-Unable to perform operation
-System privilege CHANGE_MAPPING_RULES is missing
```

The error indicates that executing ALTER ROLE was allowed, but only the attempt 
to then create a mapping fails.

As error message I would expect:

"""
Statement failed, SQLSTATE = 28000
unsuccessful metadata update
-ALTER ROLE RDB$ADMIN failed
-no permission for ALTER access to ROLE RDB$ADMIN
-Effective user is TESTUSER
"""

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6489) User without ALTER ANY ROLE privilege can use COMMENT ON ROLE

2021-02-16 Thread Mark Rotteveel (JIRA)
User without ALTER ANY ROLE privilege can use COMMENT ON ROLE
-

 Key: CORE-6489
 URL: http://tracker.firebirdsql.org/browse/CORE-6489
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Mark Rotteveel


A normal user without the ALTER ANY ROLE privilege is allowed to put comments 
on roles.

```
create user testuser password 'testuser';
commit;
connect '' user testuser password 'testuser';
comment on role rdb$admin is 'unprivileged comment';
commit;
```

The comment is added on role RDB$ADMIN without error, expected behaviour is an 
error with a message like:

"""
Statement failed, SQLSTATE = 28000
unsuccessful metadata update
-COMMENT ON XYZ failed
-no permission for ALTER access to ROLE RDB$ADMIN
-Effective user is TESTUSER
"""


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6488) Event delivery could be missed when local (XNET) protocol is used

2021-02-15 Thread Vlad Khorsun (JIRA)
Event delivery could be missed when local (XNET) protocol is used
-

 Key: CORE-6488
 URL: http://tracker.firebirdsql.org/browse/CORE-6488
 Project: Firebird Core
  Issue Type: Bug
  Components: API / Client Library, Engine
Affects Versions: 4.0 RC 1, 3.0.7, 2.5.9
 Environment: Windows only
Reporter: Vlad Khorsun


The bug was reported at https://www.sql.ru/forum/165/

The problem could happen when:
- the op_event packet is longer than the XNET transmission buffer length (100 
bytes), and 
- client start to read data a bit later than server write first 100 bytes.

In this case race between writer and reader could happen and reader could miss 
first 100 bytes of the packet contents.

The bug is close to impossible to reproduce without artificial manipulation by 
running threads using debugger.
It might explain why it was not detected so far, since XNET was introduced.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6487) FETCH ABSOLUTE and RELATIVE beyond bounds of cursor should always position immediately before-first or after-last

2021-02-15 Thread Mark Rotteveel (JIRA)
FETCH ABSOLUTE and RELATIVE beyond bounds of cursor should always position 
immediately before-first or after-last
-

 Key: CORE-6487
 URL: http://tracker.firebirdsql.org/browse/CORE-6487
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 4.0 RC 1, 3.0.7
Reporter: Mark Rotteveel


With FETCH ABSOLUTE n and FETCH RELATIVE n, it is possible to position the 
cursor beyond the bounds of the result set. Currently the actual position is 
remembered, and this has unexpected effects on subsequent use of FETCH RELATIVE 
n: The offset (n) used must be large enough the position the cursor back within 
bounds.

For example 

execute block
  returns (rowval integer, rowcount integer)
as
  declare c scroll cursor for (select 1 as rowval from rdb$database union all 
select 2 as rowval from rdb$database union all select 3 as rowval from 
rdb$database);
begin
   open c;
fetch absolute 5 from c;
-- fetch relative -1 from c;
-- fetch prior from c;
fetch relative -2 from c;
rowval = c.rowval;
rowcount = row_count;
suspend;
end 

The FETCH ABSOLUTE 5 positions the cursor two rows beyond the last row. Using 
FETCH RELATIVE -2 or FETCH PRIOR will return the last row, while FETCH RELATIVE 
-1 is not sufficient.

For consistent behaviour (i.e. FETCH NEXT and FETCH RELATIVE 1, and FETCH PRIOR 
and FETCH RELATIVE -1 behaving identical), it would be better that any move out 
of bounds of the result set, will position the cursor immediately before the 
first row (position = 0) or immediately after the last row (position = last + 
1). This would also match the behaviour specified in ODBC for SQLFetchScroll(), 
and in JDBC for ResultSet.absolute(int) and ResultSet.relative(int)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6486) FETCH RELATIVE has an off by one error for the first row

2021-02-14 Thread Mark Rotteveel (JIRA)
FETCH RELATIVE has an off by one error for the first row


 Key: CORE-6486
 URL: http://tracker.firebirdsql.org/browse/CORE-6486
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7, 4.0 RC 1
 Environment: Windows 10 64-bit
Firebird-4.0.0.2353-0-RC1-x64 / Firebird-3.0.7.33374-1_x64
Reporter: Mark Rotteveel


The FETCH RELATIVE 1 FROM cursor_name statement should be equivalent to FETCH 
NEXT FROM cursor_name (or FETCH cursor_name), however it skips the first row;

execute block
  returns (rowval integer, rowcount integer)
as
  declare c scroll cursor for (select 1 as rowval from rdb$database union all 
select 2 as rowval from rdb$database  union all select 3 as rowval from 
rdb$database);
begin
   open c;
-- fetch next from c;
fetch relative 1 from c;
rowval = c.rowval;
rowcount = row_count;
suspend;
end

This returns (2, 1) for (rowval, rowcount), instead of expected (1, 1). For 
subsequent fetches, it behaves as expected, so it seems to problem is with the 
first FETCH RELATIVE only. Using FETCH RELATIVE 2 FROM c will return (3,1) 
instead of (2,1).

It seems to behave as if the first row was already fetched, but using FETCH 
RELATIVE 0 FROM c will produce error "Cursor C is not positioned in a valid 
record".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6485) Provide time zone ids constants in public headers

2021-02-13 Thread Dimitry Sibiryakov (JIRA)
Provide time zone ids constants in public headers
-

 Key: CORE-6485
 URL: http://tracker.firebirdsql.org/browse/CORE-6485
 Project: Firebird Core
  Issue Type: Improvement
  Components: API / Client Library
Reporter: Dimitry Sibiryakov


It would be nice if client applications could use named constants working with 
types with time zones instead of magic numbers.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6484) Firebird can't count records from a subquery with unnamed column

2021-02-08 Thread JIRA
Firebird can't count records from a subquery with unnamed column


 Key: CORE-6484
 URL: http://tracker.firebirdsql.org/browse/CORE-6484
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7
 Environment: Windows 10 64-bit
Reporter: Silvio Clécio


Consider the following table:

{code:sql}
CREATE TABLE persons (
  ID integer GENERATED BY DEFAULT AS IDENTITY  NOT NULL,
  name VARCHAR(100) NOT NULL
  age SMALLINT NOT NULL
);
{code:sql}

and the following records:

{code:sql}
INSERT INTO persons (id, name, age) VALUES (1, 'Joe', 12);
INSERT INTO persons (id, name, age) VALUES (2, 'Annie', 29);
INSERT INTO persons (id, name, age) VALUES (3, 'Robert', 35);
INSERT INTO persons (id, name, age) VALUES (4, 'Margaret', 12);
{code}

when you try to run (I have been using FlameRobin) the following SQL:

{code:sql}
SELECT COUNT(*) FROM (
  SELECT age, COUNT(*) FROM persons
  GROUP BY age
) AS t
{code}

the Firebird returns the following error:

{code}
Error: *** IBPP::SQLException ***
Context: Statement::Prepare( SELECT COUNT(*) FROM (
  SELECT age, COUNT(*) FROM persons
  GROUP BY age
) AS t )
Message: isc_dsql_prepare failed
SQL Message : -104
Invalid token
Engine Code: 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Invalid command
no column name specified for column number 2 in derived table T
{code}

however, it works fine in other DBMSes, like PostgreSQL, MySQL or even in a 
non-DBMS, like SQLite. 

I'm not Firebird expert, but it sounds like a bug.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6483) Firebird can't count records from a subquery with unnamed column

2021-02-07 Thread JIRA
Firebird can't count records from a subquery with unnamed column


 Key: CORE-6483
 URL: http://tracker.firebirdsql.org/browse/CORE-6483
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7
 Environment: Windows 10 64-bit
Reporter: Silvio Clécio


Consider the following table:

{code:sql}
CREATE TABLE persons (
  ID integer GENERATED BY DEFAULT AS IDENTITY  NOT NULL,
  name VARCHAR(100) NOT NULL
  age SMALLINT NOT NULL
);
{code:sql}

and the following records:

{code:sql}
INSERT INTO persons (id, name, age) VALUES (1, 'Joe', 12);
INSERT INTO persons (id, name, age) VALUES (2, 'Annie', 29);
INSERT INTO persons (id, name, age) VALUES (3, 'Robert', 35);
INSERT INTO persons (id, name, age) VALUES (4, 'Margaret', 12);
{code}

when you try to run (I have been using FlameRobin) the following SQL:

{code:sql}
SELECT COUNT(*) FROM (
  SELECT age, COUNT(*) FROM persons
  GROUP BY age
) AS t
{code}

the Firebird returns the following error:

{code}
Error: *** IBPP::SQLException ***
Context: Statement::Prepare( SELECT COUNT(*) FROM (
  SELECT age, COUNT(*) FROM persons
  GROUP BY age
) AS t )
Message: isc_dsql_prepare failed
SQL Message : -104
Invalid token
Engine Code: 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Invalid command
no column name specified for column number 2 in derived table T
{code}

however, it works fine in other DBMSes, like PostgreSQL, MySQL or even in a 
non-DBMS, like SQLite. 

I'm not Firebird expert, but it sounds like a bug.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6482) System table with keywords

2021-02-05 Thread Maxim Kuzmin (JIRA)
System table with keywords
--

 Key: CORE-6482
 URL: http://tracker.firebirdsql.org/browse/CORE-6482
 Project: Firebird Core
  Issue Type: New Feature
Reporter: Maxim Kuzmin


List of keywords (reserved and non-reserved) changed in major/minor version, 
including release version.
To determine whether a word is a keyword and it reserved, need to have a 
dictionary of such words, and update it for each version of the server.
You should also remember that some words will become reserved in the future 
(LOCALTIME, SQLSTATE, INSERTING/DELETING/UPDATING).
Therefore we need a table of words with the flag "Reserved" and "Reserved in 
the future".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6481) Dialect 1. Not consistent result of two expressions with divide of NUMERIC with scale

2021-02-02 Thread Kovalenko Dmitry (JIRA)
Dialect 1. Not consistent result of two expressions with divide of NUMERIC with 
scale
-

 Key: CORE-6481
 URL: http://tracker.firebirdsql.org/browse/CORE-6481
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.8
 Environment: Database with first dialect
Reporter: Kovalenko Dmitry
Priority: Minor


Not consistent result of two expressions with divide:

1. cast(2 as NUMERIC(2,  1)) / cast(3 as NUMERIC(2,0))

returns DOUBLE value: 0.6(6) without any information about scale

2. cast(cast(2 as NUMERIC(2,  1)) / cast(3 as NUMERIC(2,0)) AS VARCHAR(32))

returns VARCHAR value: 0.7

---
d:\Program_Files\Firebird_3_0_x64>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> CONNECT "inet4://localhost/d:\database\RAM\IBP_TEST_FB30_D1.GDB";
Database: "inet4://localhost/d:\database\RAM\IBP_TEST_FB30_D1.GDB", User: 
HOME4\DIMA
SQL> SET SQLDA_DISPLAY ON;
SQL> select cast(2 as NUMERIC(2,  1)) / cast(3 as NUMERIC(2,0)) from dual;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 480 DOUBLE scale: 0 subtype: 0 len: 8
  :  name: DIVIDE  alias: DIVIDE
  : table:   owner:

 DIVIDE
===
 0.

SQL> select cast(cast(2 as NUMERIC(2,  1)) / cast(3 as NUMERIC(2,0)) AS 
VARCHAR(32)) from dual;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 32 charset: 0 NONE
  :  name: CAST  alias: CAST
  : table:   owner:

CAST

0.7
-

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6480) Multiple sum query cause ad incorrect SQLDA structure error

2021-02-02 Thread William Pristia (JIRA)
Multiple sum query cause ad incorrect SQLDA structure error
---

 Key: CORE-6480
 URL: http://tracker.firebirdsql.org/browse/CORE-6480
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 Beta 2
 Environment: WINDOWS 10, INTEL CORE I9 9900, 64GB RAM
Client sofdtware : DLEPHI, IBEXPERT (same error)
Reporter: William Pristia


This query 

SELECT
  SUM(QUANTITA_NETTA) QUANTITA_MATURATA_COMPENSATA,
  SUM(QUANTITA_SOTTO_MINIMO) QUANTITA_SOTTO_MINIMO,
  SUM(QUANTITA_SOPRA_MASSIMO) QUANTITA_SOPRA_MASSIMO,
  SUM(QUANTITA_VALUTATA) QUANTITA_VALUTATA,
  SUM(QUANTITA_SVOLTA) QUANTITA_SVOLTA,
  SUM(QUANTITA_SVOLTA_FESTIVO) QUANTITA_SVOLTA_FESTIVO,
  SUM(QUANTITA_SVOLTA_NOTTURNO) QUANTITA_SVOLTA_NOTTURNO
FROM APP_SORVEGLIANTI_DATI_S SDG
  INNER JOIN APP_CONTRATTI_DATI CD ON 
(CD.ID_CONTRATTO_DATO=SDG.ID_CONTRATTO_DATO)
  INNER JOIN APP_SYS_TP_CONTRATTO_DATO TCD ON 
(TCD.ID_TP_CONTRATTO_DATO=SDG.ID_TP_CONTRATTO_DATO_MISURA)
WHERE SDG.ID_PAGA=53 AND SDG.ID_SORVEGLIANTE=260 AND SDG.ID_ASSUNZIONE=501 AND 
CD.ID_CONTRATTO_DATO=1566 AND
  ((SDG.DATA_INIZIO BETWEEN '01.01.2021' AND '31.01.2021') OR (SDG.DATA_FINE 
BETWEEN '01.01.2021' AND '31.01.2021'))

and all queries of this kind generate this error :

An error was found in the application program input parameters for the SQL 
statement.
Incorrect values within SQLDA structure.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6479) COMMENT ON USER can only apply comment on user defined by the default usermanager plugin

2021-01-31 Thread Mark Rotteveel (JIRA)
COMMENT ON USER can only apply comment on user defined by the default 
usermanager plugin


 Key: CORE-6479
 URL: http://tracker.firebirdsql.org/browse/CORE-6479
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7, 4.0 Beta 2
Reporter: Mark Rotteveel


The COMMENT ON USER statement can only put comments on users of the default 
usermanager. The syntax should be extended to include an optional USING PLUGIN 
 clause. For example `COMMENT ON USER x USING PLUGIN pluginname IS 
'comment'`

With setting UserManager = Srp,Legacy_UserManager.

create user test1 password 'test1' using plugin srp;
create user test2 password 'test2' using plugin legacy_usermanager;

commit;

The following will succeed:

comment on user test1 is 'comment on user test1';

The following will fail:

comment on user test2 is `comment on user test2';

[336723990] [HY000]: Resource Exception. record not found for user: TEST2

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6478) gbak discard replicate mode

2021-01-30 Thread Dimitry Sibiryakov (JIRA)
gbak discard replicate mode
---

 Key: CORE-6478
 URL: http://tracker.firebirdsql.org/browse/CORE-6478
 Project: Firebird Core
  Issue Type: Bug
  Components: GBAK
Affects Versions: 4.0 Beta 2
Reporter: Dimitry Sibiryakov
Priority: Minor


gbak neither store nor restore replica mode. As the result it is reset to NONE 
after backup-restore cycle.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6477) Rare race condition in Plugin Manager could lead to the server crash

2021-01-28 Thread Vlad Khorsun (JIRA)
Rare race condition in Plugin Manager could lead to the server crash


 Key: CORE-6477
 URL: http://tracker.firebirdsql.org/browse/CORE-6477
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7
Reporter: Vlad Khorsun
 Attachments: stack.txt



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6476) Call to Services API on 1st FB instance blocks start of audit session in 2nd FB instance for 130 seconds

2021-01-28 Thread Pavel Zotov (JIRA)
7483647
TempDirectories = d:\temp
UDFAccess = Restrict UDF
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4
=

Config file for 2nd FB:
=
AuditTraceConfigFile = "C:\FBTESTING\qa\fbt-repo\tmp\tmp_c5993_audit.cfg"
AuthClient = Srp
AuthServer = Srp
BugcheckAbort = 1
IpcName = tmp_ipc_5993
RemoteServiceName = tmp_fbs_5993
RemoteServicePort = 57456
ServerMode = Super
WireCrypt = Required
=

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6475) Memory leak when running EXECUTE STATEMENT with named parameters

2021-01-23 Thread Vlad Khorsun (JIRA)
Memory leak when running EXECUTE STATEMENT with named parameters


 Key: CORE-6475
 URL: http://tracker.firebirdsql.org/browse/CORE-6475
 Project: Firebird Core
  Issue Type: Bug
  Components: API / Client Library
Affects Versions: 4.0 Beta 2
Reporter: Vlad Khorsun


The small memory leak (96 bytes per named parameter) was introduced with 
CORE-5658

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6474) Report replica mode through isc_database_info, MON$DATABASE and SYSTEM context

2021-01-23 Thread Mark Rotteveel (JIRA)
Report replica mode through isc_database_info, MON$DATABASE and SYSTEM context
--

 Key: CORE-6474
 URL: http://tracker.firebirdsql.org/browse/CORE-6474
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Affects Versions: 4.0 RC 1
Reporter: Mark Rotteveel


As discussed on firebird-devel, the replica mode should be exposed through an 
isc_database_info/Attachment::getInfo(), MON$DATABASE, and - maybe - the SYSTEM 
context.

The reported mode should be

- none (database is a primary or standalone)
- read-only
- read-write

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6473) Align parsing between alias and path parts of databases.conf

2021-01-22 Thread Basil A. Sidorov (JIRA)
Align parsing between alias and path parts of databases.conf


 Key: CORE-6473
 URL: http://tracker.firebirdsql.org/browse/CORE-6473
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Reporter: Basil A. Sidorov
Priority: Minor


Currently quoted string may used only in right (path) part of alias definition 
in databases.conf.

If
some_path = another_path # valid
and
some_path = "another path" # valid also
then
"some path" = "anoter_path" # is error but must be valid

Left (alias itself) and right (path) parts of alias definition must be parsed 
by single ruleset with all OS-depended (case sensitive) and Firebird macros 
features.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6472) Wrong byte order on UUIDs in gstat and monitoring output

2021-01-22 Thread Dimitry Sibiryakov (JIRA)
Wrong byte order on UUIDs in gstat and monitoring output


 Key: CORE-6472
 URL: http://tracker.firebirdsql.org/browse/CORE-6472
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine, GSTAT
Affects Versions: 3.0.7, 4.0 Beta 2
Reporter: Dimitry Sibiryakov
Priority: Minor


Database UID is displayed wrongly by gstat, API and monitoring tables. It makes 
output incompatible with UUIDs stored in data fields.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6471) Add MON$ELAPSED_TIME to MON$STATEMENTS

2021-01-20 Thread Karol Bieniaszewski (JIRA)
Add MON$ELAPSED_TIME to MON$STATEMENTS
--

 Key: CORE-6471
 URL: http://tracker.firebirdsql.org/browse/CORE-6471
 Project: Firebird Core
  Issue Type: New Feature
  Components: Engine
Reporter: Karol Bieniaszewski


Add cumulative time during query execution. Query can be be stalled and active 
back in long intervals but it can be relative short as a whole.

Look at discussion with Vlad Khorsun in CORE-6456 maybe you find more 
fields/statistics to add.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6470) Provide ability to suppress localized messages in error stack (or make them to be encoded to required charset, say 'utf8')

2021-01-20 Thread Pavel Zotov (JIRA)
Provide ability to suppress localized messages in error stack (or make them to 
be encoded to required charset, say 'utf8')
--

 Key: CORE-6470
 URL: http://tracker.firebirdsql.org/browse/CORE-6470
 Project: Firebird Core
  Issue Type: Improvement
Reporter: Pavel Zotov
 Attachments: file-related-error-messages-in-localized-form.png

I can't understand for what reason FB utilities issue part of error messages in 
localized form.
Please provide ability either to fully supress such messages or make them be 
displayed in apropriate encoding, which must be equal to connection charset.

Please look:

C:\HQBWork\1IMPORTANT\QA-rundaily>chcp
Active code page: 65001

C:\HQBWork\1IMPORTANT\QA-rundaily>echo set names utf8; create database 
'z:\nosuch_disk\no_such_folder\foo.fdb' user sysdba password 'masterkey'; | 
isql -q 1>isql-stdout.log 2>isql-stderr.log

C:\HQBWork\1IMPORTANT\QA-rundaily>type isql-stderr.log
Statement failed, SQLSTATE = 08006
Unable to complete network request to host "z".
-Failed to locate host machine.
-The specified name was not found in the hosts file or Domain Name Services.

// here we see all messages in ascii (good).

C:\HQBWork\1IMPORTANT\QA-rundaily>echo set names utf8; create database 
'c:\no_such_folder\foo.fdb' user sysdba password 'masterkey'; | isql -q 
1>isql-stdout.log 2>isql-stderr.log

C:\HQBWork\1IMPORTANT\QA-rundaily>type isql-stderr.log
Statement failed, SQLSTATE = 08001
I/O error during "CreateFile (create)" operation for file 
"C:\NO_SUCH_FOLDER\FOO.FDB"
-Error while trying to create file
-��� �� ��� � � .

// here we can not read last line

C:\HQBWork\1IMPORTANT\QA-rundaily>chcp 1251
Active code page: 1251

C:\HQBWork\1IMPORTANT\QA-rundaily>type isql-stderr.log
Statement failed, SQLSTATE = 08001
I/O error during "CreateFile (create)" operation for file 
"C:\NO_SUCH_FOLDER\FOO.FDB"
-Error while trying to create file
-Системе не удается найти указанный путь.

// here we *can* read last line but we have to change code page to that Windows 
uses.

I can not imagine FB admin who will not be able to translate from english 
messages related to file/process access. Or at least to use goodle translate.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6469) Provide ability to see in the trace log actions related to session management (e.g. ALTER SESSION RESET)

2021-01-18 Thread Pavel Zotov (JIRA)
Provide ability to see in the trace log actions related to session management 
(e.g. ALTER SESSION RESET)


 Key: CORE-6469
 URL: http://tracker.firebirdsql.org/browse/CORE-6469
 Project: Firebird Core
  Issue Type: Improvement
Affects Versions: 4.0 Beta 2
Reporter: Pavel Zotov
Priority: Minor


Ticket has been created after discuss with Vlad.
Currently trace log does not contain info about requests related to session 
management. It will be nice to see such info there.

Example:
1) create config for trace:
===
database =
{
enabled = true
log_initfini = false

log_errors = true
time_threshold = 0

log_connections = true
log_transactions = true

log_statement_finish = true
}
===
- and run trace

2) run following .sql:
===
set bail on;
shell del c:\temp\tmp4test.fdb 2>nul;
create database 'localhost:c:\temp\tmp4test.fdb' user 'sysdba' password 
'masterkey';

set list on;
set autoddl off;
commit;

select cast(1234.5678 as decfloat(16)) as before_ssn_reset from rdb$database;

alter session reset;

select cast(3456.7890 as decfloat(16)) as after_ssn_reset from rdb$database;
===

In the trace log we see:
===
2021-01-19T07:53:11.6930 (2360:061C0640) START_TRANSACTION
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_7, CONCURRENCY | WAIT | READ_WRITE)

2021-01-19T07:53:11.6940 (2360:061C0640) EXECUTE_STATEMENT_FINISH
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_7, CONCURRENCY | WAIT | READ_WRITE)

Statement 6:
---
select cast(1234.5678 as decfloat(16)) as before_ssn_reset from rdb$database
1 records fetched
  0 ms, 5 fetch(es)

2021-01-19T07:53:11.6940 (2360:061C0640) ROLLBACK_TRANSACTION
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_7, CONCURRENCY | WAIT | READ_WRITE)
  0 ms, 1 fetch(es), 1 mark(s)

2021-01-19T07:53:11.6950 (2360:061C0640) START_TRANSACTION
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_8, CONCURRENCY | WAIT | READ_WRITE)

2021-01-19T07:53:11.6950 (2360:061C0640) EXECUTE_STATEMENT_FINISH
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_8, CONCURRENCY | WAIT | READ_WRITE)

Statement 7:
---
select cast(3456.7890 as decfloat(16)) as after_ssn_reset from rdb$database
1 records fetched
  0 ms, 5 fetch(es)

2021-01-19T07:53:11.6950 (2360:061C0640) COMMIT_TRANSACTION
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
(TRA_8, CONCURRENCY | WAIT | READ_WRITE)
  0 ms, 1 fetch(es), 1 mark(s)

2021-01-19T07:53:11.6960 (2360:061C0640) DETACH_DATABASE
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/61195)
C:\FB\40SS\isql.exe:7044
===

One can guess that something happen about session only by watching for Tx 
numbers (TRA_7 rolled back and TRA_8 appeared - without explicit command to 
finish 1st of them).
It will be good to see explicitly mentioned session-level statement between 
ROLLBACK and START Tx statements.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6468) Wire compression causes sporadic "Error reading data from the connection." errors.

2021-01-14 Thread michalk1 (JIRA)
Wire compression causes sporadic "Error reading data from the connection." 
errors.
--

 Key: CORE-6468
 URL: http://tracker.firebirdsql.org/browse/CORE-6468
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7
 Environment: Firebird 3.0.7, Windows 10
Reporter: michalk1
 Attachments: TestCase.zip

I came across this problem infrequently since first FB 3 versions. Now I 
finally found that it is related to WireCompression and was able to create a 
relatively reproducible test case. It consists of a repeated run of a long sql 
statement, with commits between them. It is easier to spot the error when the 
test is run concurrently from more consoles.

Steps to reproduce:
1) Make a copy of a employee.fdb (or any other database) database, for example 
to "C:\Tmp\employee.fdb".
2) Modify firebird.conf to enable client wire compression (WireCompression = 
true).
3) Unzip test case script files (TestMain.sql and TestCmd.sql), say to 
"C:\Tmp\". TestCmd.sql is the command itself followed by a commit, TestMain.sql 
is there just to call it repeatedly.
3) Run several command line consoles (two should be enough), and in each of 
them, execute the sql script in isql:
  isql -user SYSDBA -password masterkey localhost:C:\Tmp\employee.fdb -i 
"C:\Tmp\TestMain.sql"
4) Sooner or later in some of the consoles (you may run the script repeatedly 
of from more consoles) you should spot the errors. The first one is always 
"Error reading data from the connection.". Following "Error writing data from 
the connection." are just consequence of the already dropped connection.

Clues:
- Disabling wire compression results in no errors at all.
- Short sql statement are less likely to be affected, may be there is even a 
threshold under which the error doesn't occur. Contents of the long sql 
statement probably doesn't matter, just it's length.
- When the error arises, other connections continue to run (at least for some 
time), which means that the problem is not caused by a server crash. It is just 
the single connection that drops out.
- So far i couldn't reproduce the problem against Linux server, it may be 
Windows specific.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6467) Not all SQL comments preserved in CREATE PROCEDURE like before

2021-01-12 Thread Martijn Tonies (JIRA)
Not all SQL comments preserved in CREATE PROCEDURE like before
--

 Key: CORE-6467
 URL: http://tracker.firebirdsql.org/browse/CORE-6467
 Project: Firebird Core
  Issue Type: Bug
  Components: Scripts
Affects Versions: 3.0.7
Reporter: Martijn Tonies
Priority: Minor


> In Firebird 2.5, comments after AS are preserved, in Firebird 3, this 
> has changed.
> 
> CREATE PROCEDURE myproc (i integer)
> returns
> (i2 integer)
> AS
> /* test */
> declare variable v varchar(20);
> begin
> 
> This comment is preserved in Firebird 2.5, but not in Firebird 3.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6466) Seems Firebird removes comments before the first line of code

2021-01-12 Thread Sergio Toniutti (JIRA)
Seems Firebird removes comments before the first line of code
-

 Key: CORE-6466
 URL: http://tracker.firebirdsql.org/browse/CORE-6466
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.6
 Environment: Ubuntu 20.04.01
Reporter: Sergio Toniutti


Seems Firebird removes comments before the first line of code when i execute 
create or alter procedure.
If i have:
SET TERM ^^ ;
CREATE OR ALTER PROCEDURE P_INC (
  INT_A Integer)
 returns (
  INT_B Integer)
AS
/*
this is a bug!
*/
declare variable int_c integer=2;
begin
  /* code */
  int_b=int_a+int_c+2;
  suspend;
end ^^
SET TERM ; ^^

the result is:

SET TERM ^^ ;
CREATE OR ALTER PROCEDURE P_INC (
  INT_A Integer)
 returns (
  INT_B Integer)
AS
declare variable int_c integer=2;
begin
  /* code */
  int_b=int_a+int_c+2;
  suspend;
end ^^
SET TERM ; ^^

Thanks,
Sergio

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6465) Dropping table fails after creating indexes

2021-01-08 Thread Jacob Lee (JIRA)
Dropping table fails after creating indexes
---

 Key: CORE-6465
 URL: http://tracker.firebirdsql.org/browse/CORE-6465
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
 Environment: windows 10
Reporter: Jacob Lee


When a table has any indexes including primary key, then dropping tables seems 
to get failure.

The following is the test code:

D:\>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database './data/testdb.fdb'
CON> user 'SYSDBA' password 'masterkey';
SQL> create table test (
CON> id integer generated by default as identity primary key,
CON> name varchar(20) not null
CON> );
SQL> show tables;
   TEST
SQL> show table test;
ID  INTEGER Not Null Identity (by default)
NAMEVARCHAR(20) Not Null
CONSTRAINT INTEG_1:
  Primary key (ID)
SQL> insert into test (name) values ('computer');
SQL> insert into test (name) values ('mouse');
SQL> insert into test (name) values ('keyboard');
SQL> insert into test (name) values ('monitor');
SQL> delete from test;
SQL> select * from test;
SQL> drop table test;
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-object TABLE "TEST" is in use
SQL> drop database;
SQL>



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6464) ES/EDS and ExtConnPool problem: EDS-connection may see old value of generator if it is established twise and interval is less than ExtConnPoolLifeTim

2021-01-06 Thread Pavel Zotov (JIRA)
t' exists ? => YES, 'G_EDS_TEST' exists.

INIT_SEQ_VALUE  0

SEQ_VALUE_AFTER_RECONNECT   0

GEN_VALUE_BEFORE_INC0
GEN_VALUE_AFTER__INC123

FINAL_SEQ_VALUE Expected: 123

MSG point-3
DTS 2021-01-07 10:30:05.0920
Does sequence 'g_eds_test' exists ? => NO, it doesn't

=== bye-bye from SQL === 


Take delay for 6 s, i.e. ### GREATER ### than ECP lifetime. . .

Waiting for 6 seconds, press a key to continue ...5 4 3 2 1 0

Check result after "long delay":

MSG point-1
DTS 2021-01-07 10:30:11.5640
Does sequence 'g_eds_test' exists ? => NO, it doesn't


MSG point-2
DTS 2021-01-07 10:30:11.5790
Does sequence 'g_eds_test' exists ? => YES, 'G_EDS_TEST' exists.

INIT_SEQ_VALUE  0

SEQ_VALUE_AFTER_RECONNECT   0

GEN_VALUE_BEFORE_INC0
GEN_VALUE_AFTER__INC123

FINAL_SEQ_VALUE Expected: 123

MSG point-3
DTS 2021-01-07 10:30:12.1600
Does sequence 'g_eds_test' exists ? => NO, it doesn't

=== bye-bye from SQL === 


Take delay for 4 s, i.e. ### SHORTER ### than ECP lifetime. . .

Waiting for 4 seconds, press a key to continue ...3 2 1 0

Check result after "short delay":

MSG point-1
DTS 2021-01-07 10:30:16.2370
Does sequence 'g_eds_test' exists ? => NO, it doesn't


MSG point-2
DTS 2021-01-07 10:30:16.2560
Does sequence 'g_eds_test' exists ? => YES, 'G_EDS_TEST' exists.


INIT_SEQ_VALUE  0

SEQ_VALUE_AFTER_RECONNECT   0

GEN_VALUE_BEFORE_INC123
GEN_VALUE_AFTER__INC246

FINAL_SEQ_VALUE UNEXPECTED >>> 0 <<< ?

MSG point-3
DTS 2021-01-07 10:30:16.3380
Does sequence 'g_eds_test' exists ? => NO, it doesn't

=== bye-bye from SQL === 


As you can see, sequence is recreated every time. 
But its *OLD* value (123) still visible to procedure 'sp_increment_sequence' 
when it is called via ES/EDS and - most important -  time from previous call is 
less then ExtConnPoolLifeTime.

If we uncomment line "-- role 'A' || 
replace(lpad('',30,uuid_to_char(gen_uuid())),'-','')" and repeat than result is 
expected:
=
GEN_VALUE_BEFORE_INC0
GEN_VALUE_AFTER__INC123
FINAL_SEQ_VALUE Expected: 123
=

(using ROLE clause with random value forces EDS mechanism to create totally new 
connection, AFAIK).


PS. WI-V4.0.0.2307 Firebird 4.0 Release Candidate 1


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6463) Confusing message (conversion error from STRING " ") when use parametrized ES and "?" has no explicit CAST()

2021-01-06 Thread Pavel Zotov (JIRA)
Confusing message (conversion error from STRING " ") when use parametrized ES 
and "?" has no explicit CAST()


 Key: CORE-6463
 URL: http://tracker.firebirdsql.org/browse/CORE-6463
 Project: Firebird Core
  Issue Type: Improvement
Affects Versions: 3.0.7, 4.0 Beta 2
Reporter: Pavel Zotov
Priority: Minor


Run this on 2.5, 3.x and 4.x:
===
set sqlda_display on;
set term ^;
execute block returns(o_rel_id int) as
begin
execute statement ('select iif(1 <= ?, ?, null) from rdb$database') (2, 3) 
into o_rel_id;
suspend;
end
^
set term ;^

Output:
1) on 2.5:

INPUT  SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 1
01: sqltype: 497 LONG Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 4
  :  name: (8)O_REL_ID  alias: (8)O_REL_ID
  : table: (0)  owner: (0)

O_REL_ID 
 
Statement failed, SQLSTATE = HY004
Dynamic SQL Error
-SQL error code = -804
-Data type unknown
-At block line: 3, col: 5


2) on 3.x and 4.x:

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 496 LONG Nullable scale: 0 subtype: 0 len: 4
  :  name: O_REL_ID  alias: O_REL_ID
  : table:   owner: 

O_REL_ID 
 
Statement failed, SQLSTATE = 22018
conversion error from string " "
-At block line: 3, col: 5


One need to know in advance that NULL w/o CAST() is considered as CHAR(1), but  
i could not find this in the $FB_HOME/doc/* and in 
https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/nullguide/firebird-null-guide.html
Phrase: conversion error from string " "  -- definitely looks weird (there is 
no any text variables / parameters in this example).

Perhaps, it will be better to change this message back to 2.5.x ?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6462) Implement for LEAD, LAG, FIRST_VALUE, LAST_VALUE and NTH_VALUE

2021-01-06 Thread Mark Rotteveel (JIRA)
Implement  for LEAD, LAG, FIRST_VALUE, LAST_VALUE and NTH_VALUE
---

 Key: CORE-6462
 URL: http://tracker.firebirdsql.org/browse/CORE-6462
 Project: Firebird Core
  Issue Type: Improvement
  Components: Engine
Affects Versions: 3.0.7, 4.0 Beta 2
Reporter: Mark Rotteveel


SQL:2016 defines a  clause for LEAD, LAG, FIRST_VALUE, 
LAST_VALUE and NTH_VALUE, which specifies if nulls are ignored 
(skipped/eliminated) or not. Currently Firebird only implements the implicit 
default behaviour (RESPECT NULLS).

Relevant syntax:

"""
 ::=

  [   [   ] ] 
  [  ]

 ::=
  LEAD | LAG

 ::=
  RESPECT NULLS | IGNORE NULLS

 ::=
  [  ]

 ::=
  FIRST_VALUE | LAST_VALUE

 ::=
  NTH_VALUE 
[  ] [  ]
"""

Relevant syntax rules:

"""
6) ...
j) If  is specified, then:
i) ...
ii) ...
iii) ...
iv) If  is specified, then let NTREAT be the ; 
otherwise, let NTREAT be RESPECT NULLS.
v) ...

7) If  or  is specified, then:
a) ...
b) If  is not specified, then RESPECT NULLS is implicit.
c) ...
"""

Relevant general rules:

"""
b) If  is , then:
i) Let OFFSET be the value of OFF and let DEFAULT be the value of VE2.
ii) Let T be the collection of rows in the window frame of the current row 
defined by WDX, as specified by the General Rules of Subclause 7.15, "".
iii) If LEAD is specified, then:
1) Case:
A) If NTREAT is RESPECT NULLS, then let TX be the sequence of values that is 
the result of applying VE1 to each row of T that follows the current row, 
ordered according to the window ordering of WDX.
B) Otherwise, let TX be the sequence of values that is the result of applying 
VE1 to each row of T that follows the current row and eliminating null values, 
ordered according to the window ordering of WDX.
2) Let n be the number of values in TX.
3) Case:
A) If OFFSET > n, then the value of  is DEFAULT.
B) If OFFSET = 0 (zero), then the value of  is the value of 
VE1 evaluated for the current row.
C) Otherwise, the value of  is the m-th value of TX, where m = 
OFFSET.
iv) If LAG is specified, then:
1) Case:
A) If NTREAT is RESPECT NULLS, then let TX be the sequence of values that is 
the result of applying VE1 to each row of T that precedes the current row, 
ordered according to the row ordering of WDX.
B) Otherwise, let TX be the sequence of values that is the result of applying 
VE1 to each row of T that precedes the current row and eliminating null values, 
ordered according to the row ordering of WDX.
2) Let n be the number of values in TX.
3) Case:
A) If OFFSET > n, then the value of  is DEFAULT.
B) If OFFSET = 0 (zero), then the value of  is the value of 
VE1 evaluated for the current row.
C) Otherwise, the value of  is the m-th value of TX, where m = 
(n - OFFSET + 1).

c) If  is , then:
i) Let T be the collection of rows in the window frame of the current row 
defined by WDX, as
specified by the General Rules of Subclause 7.15, "".
ii) Case:
1) If RESPECT NULLS is specified or implicit, then let TX be the sequence of 
values that is the result of applying the  to each row of T, 
ordered according to the row ordering of WDX.
2) Otherwise, let TX be the sequence of values that is the result of applying 
the  to each row of T and eliminating null values, ordered 
according to the row ordering of WDX.
iii) Case:
1) If TX is empty, then the value of  is the null value.
2) If FIRST_VALUE is specified, then the value of  is the 
first value of TX.
3) Otherwise, the value of  is the last value of TX.

d) If  is , then:
i) Let RN be the value of .
ii) Case:
1) If RN is the null value, then the result is the null value.
2) If RN is less than or equal to 0 (zero), then an exception condition is 
raised: data exception — invalid argument for NTH_VALUE function.
3) Otherwise:
A) Let T be the collection of rows in the window frame of the current row 
defined by WDX, as specified by the General Rules of Subclause 7.15, "".
B) Case:
I) If RESPECT NULLS is specified or implicit, then let TX be the sequence of 
values that is the result of applying the  to each row of T, 
ordered according to the row ordering of WDX.
II) Otherwise, let TX be the sequence of values that is the result of applying 
the  to each row of T and eliminating null values, ordered 
according to the row ordering of WDX.
C) Let TXN be the number of values in TX.
I) If TXN = 0 (zero) or if TXN < RN, then the value of  is the 
null value.
II) Case:
1) If FROM LAST is specified, then the value of  is the m-th 
value of TX, where m = (TXN - RN + 1).
2) Otherwise, the value of  is the m-th value of TX, where m = 
RN.
"""


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administra

[Firebird-devel] [FB-Tracker] Created: (CORE-6461) isc_dsql_execute2 failed

2021-01-01 Thread Hafedh TRIMECHE (JIRA)
isc_dsql_execute2 failed


 Key: CORE-6461
 URL: http://tracker.firebirdsql.org/browse/CORE-6461
 Project: Firebird Core
  Issue Type: Bug
  Components: API / Client Library
Affects Versions: 4.0 Beta 2
 Environment: Windows 10 64 & FlameRobin 0.9.3 & 
Firebird-4.0.0.2315-0_Win32
Reporter: Hafedh TRIMECHE


Starting transaction...
Preparing statement: DROP TABLE ACCESSLOG
Statement prepared (elapsed time: 0.000s).
Plan not available.
Parametros: 0


Executing statement...
Error: *** IBPP::SQLException ***
Context: Statement::Execute( DROP TABLE ACCESSLOG )
Message: isc_dsql_execute2 failed

SQL Message : -607
This operation is not defined for system tables.

Engine Code: 335544351
Engine Message :
unsuccessful metadata update
DROP TABLE ACCESSLOG failed
internal Firebird consistency check (missing pointer page in DPM_data_pages 
(243), file: dpm.cpp line: 779)


Total execution time: 0.190s


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6460) Incorrect query result when using named window

2020-12-27 Thread Adriano dos Santos Fernandes (JIRA)
Incorrect query result when using named window
--

 Key: CORE-6460
 URL: http://tracker.firebirdsql.org/browse/CORE-6460
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 Beta 2
Reporter: Adriano dos Santos Fernandes


Reported by Vlad by e-mail:

  Pavel Zotov found a bug with windows functions. I investigated it and seems 
found a reason.
Sample:

recreate table emp_test (
 emp_no  smallint,
 dept_no  char(3),
 salary  numeric(10,2)
);
commit;

insert into emp_test (emp_no, dept_no, salary) values ( 85, 'd01', 9);
insert into emp_test (emp_no, dept_no, salary) values (127, 'd01', 1);
commit;

select e.emp_no, e.dept_no, e.salary,
   last_value(e.salary) over (order by e.salary, e.emp_no) as last_2,
   last_value(e.salary) over w2 as last_w2,
   last_value(e.salary) over (order by e.salary, e.emp_no RANGE BETWEEN 
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as last_3,
   last_value(e.salary) over w3 as last_w3,
   last_value(e.salary) over w4 as last_w4
  from emp_test e
  window
  w1 as (),
  w2 as (w1 order by e.salary, e.emp_no),
  w3 as (w1 order by e.salary, e.emp_no RANGE BETWEEN UNBOUNDED PRECEDING 
AND UNBOUNDED FOLLOWING),
  w4 as (w2 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
order by e.emp_no

Here values in the columns last_2 and last_w2 should be equal, also equal 
should be values at
columns last_3, last_w3 and last_w4. But actually we have wrong results:

EMP_NODEPT_NOSALARYLAST_2LAST_W2LAST_3LAST_W3LAST_W4
85d01991919
127d01111911


You see - values at columns with explicit window definitions is OK, while 
columns with named windows
are wrong.

  As I found, the bug is at WindowClause::dsqlPass:

WindowClause* node = FB_NEW_POOL(dsqlScratch->getPool()) 
WindowClause(dsqlScratch->getPool(),
window->name,
doDsqlPass(dsqlScratch, window->partition),
doDsqlPass(dsqlScratch, window->order),
doDsqlPass(dsqlScratch, window->extent),
window->exclusion);

it not uses clauses from "this" when creates new window (from base window 
"window" and current
definition "this"). I tried following fix:

WindowClause* node = FB_NEW_POOL(dsqlScratch->getPool()) 
WindowClause(dsqlScratch->getPool(),
window->name,
doDsqlPass(dsqlScratch, window->partition),
doDsqlPass(dsqlScratch, this->order ? this->order : window->order),
doDsqlPass(dsqlScratch, this->extent ? this->extent : window->extent),
this->exclusion ? this->exclusion : window->exclusion);

and it works for me. Probably you have better idea.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6459) Columbased encryption

2020-12-23 Thread Jan Kohlmeyer (JIRA)
Columbased encryption
-

 Key: CORE-6459
 URL: http://tracker.firebirdsql.org/browse/CORE-6459
 Project: Firebird Core
  Issue Type: Improvement
Affects Versions: 5.0 Initial
 Environment: everywhere
Reporter: Jan Kohlmeyer


I wish a columbased encryption like in Interbase.

I want so set a few columns in a table encrypted with a default value.
If i do not have a decryption key and I select the column, i get the default 
value.

Regards.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6458) Impossible to cancel query

2020-12-22 Thread Artyom Smirnov (JIRA)
Impossible to cancel query
--

 Key: CORE-6458
 URL: http://tracker.firebirdsql.org/browse/CORE-6458
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 RC 1
Reporter: Artyom Smirnov


To reproduce it enough to create long query in isql and try to cancel it with 
Ctlr-C:

create database 'localhost:/tmp/test';
create sequence g;
select count(i) from (select gen_id(g,1) i from rdb$types a,rdb$types 
b,rdb$types c,rdb$types d);

Looks like it was broken after merging query restart functionality 
(9ac2238c3d3552c35530606ba91a7752e5bab05c).



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6457) Internal error. Database page XXXXXXXX had been changed during backup (page SCN=YYYYYYY, backup SCN=ZZZZZZZZ)

2020-12-21 Thread Lucas Schatz (JIRA)
Internal error. Database page  had been changed during backup (page 
SCN=YYY, backup SCN=)
-

 Key: CORE-6457
 URL: http://tracker.firebirdsql.org/browse/CORE-6457
 Project: Firebird Core
  Issue Type: Bug
  Components: NBACKUP
Affects Versions: 3.0.5, 3.0.4
 Environment: Firebird-3.0.5.33220-0.amd64/
CentOS Linux release 8.2.2004 (Core)
Linux 4.18.0-193.19.1.el8_2.x86_64 #1 SMP Mon Sep 14 14:37:00 UTC 2020 x86_64 
x86_64 x86_64 GNU/Linux
Server Load during the episode: <1.15
Reporter: Lucas Schatz


Hi everybody, just to explain, I`m running nbackup in 20 databases every minute 
during work time, for 1 year, and I got just 2 times this error so I`m assuming 
it`s a rare event, but I'm worried that this can corrupt the database at some 
level  

During nbackup, at level 4 and 5, I got this error:
Internal error. Database page 5160318 had been changed during backup (page 
SCN=131336, backup SCN=131334)
and (other database in another day)
Internal error. Database page 8067597 had been changed during backup (page 
SCN=67679, backup SCN=67677) 

I`ve got not much information about this, because it occurred only twice this 
year at an automatic backup system, so no more details, but what I can suspect 
is that maybe there where two nbackup process running at the same time 
(improbable)

I`d opened a topic at Google FbSupport, but no response there... so maybe here 
someone could give more info if I should be concerned or not about this error
https://groups.google.com/g/firebird-support/c/zZUHHfO3s-4

Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Reopened: (CORE-5197) Segfault when process exits with active sweep thread

2020-12-18 Thread Alexander Peshkov (JIRA)


 [ 
http://tracker.firebirdsql.org/browse/CORE-5197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Peshkov reopened CORE-5197:
-

Fix Version/s: (was: 4.0.0)
   (was: 3.0.8)

First fix did not pass regular tests

> Segfault when process exits with active sweep thread
> 
>
> Key: CORE-5197
> URL: http://tracker.firebirdsql.org/browse/CORE-5197
> Project: Firebird Core
>  Issue Type: Bug
>Affects Versions: 2.5.5, 3.0 RC2, 4.0 Initial, 3.0.0
> Environment: AIX
> Artificially reproduced on linux
>Reporter: Alexander Peshkov
>Assignee: Alexander Peshkov
>
> In case when process exits when sweep thread has not yet attached to database 
> (i.e. very fast) process does not wait for sweep thread to complete and 
> begins cleanup with sweep starting which almost for sure causes access 
> violation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6456) Add trace info about read query in packets

2020-12-14 Thread Karol Bieniaszewski (JIRA)
Add trace info about read query in packets
--

 Key: CORE-6456
 URL: http://tracker.firebirdsql.org/browse/CORE-6456
 Project: Firebird Core
  Issue Type: New Feature
  Components: Engine, TRACEMGR
Reporter: Karol Bieniaszewski


Provide the way to see info about packet read in trace.
I mean e.g.:

Table have 1 records.
I do SELECT * FROM MY_TABLE 
But i do not read all records at start (do not fetch all) but i read data in 
packets e.g. 300 records at one time.

Such statement is shown in MON$STATEMENTS as „Stalled".
Now i do not see any info in trace about this fetches.
I see only PREPARE_STATEMENT, EXECUTE_STATEMENT_START, CLOSE_CURSOR, 
EXECUTE_STATEMENT_FINISH, FREE_STATEMENT

But i need to calculate how long query was executed.
And between next 300 record fetches can be e.g. 5 minute break.
And i report then such query in my tool as long long running query which 
consume resources continously.
But really this query run only few ms. All fetches alltogether take e.g. 100ms 
but i report it as they run e.g. 1 hour.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6455) MON$TRANSACTION not returning the expected transactions in combination with C# UDR

2020-11-30 Thread Alexander Muylaert (JIRA)
MON$TRANSACTION not returning the expected transactions in combination with C# 
UDR
--

 Key: CORE-6455
 URL: http://tracker.firebirdsql.org/browse/CORE-6455
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.7
 Environment: win64
Reporter: Alexander Muylaert
 Attachments: 2020-11-30 19_49_11-[#CORE-6455] MON$TRANSACTION not 
returning the expected transactions in combinat.png

Hi

I have mon$transactions completely not returning what I expect it to return.  I 
do understand that mon are snapshot tables and I understand the consequences.
I also can't simply simulate it, I can easily show it and attached is a logfile.

The problem is that I have a Tx open, but the mon$ is NOT returning this Tx.

Because I have a setup with a Db and a Bulk db, I'm accessing mon$transactions 
through an SP that uses autonomous transactions to get the list of current 
transactions.  This should solve the problem with the snapshot as well.

t1: I open Tx1
t2: I open Tx2, call function in c# Udr, this asks to the db a list of active 
transactions.  This call uses autonomous Tx to get a list from 
mon^transactions.  But Tx1 is not returned.

I honestly can't see why and both Jiri Cincure (guy from ado.net and c# udr) 
are done a bit with debugging.  

Do you mind having a quick look at this explanation and the attached log file?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6454) Problem to connect to database after standard installation

2020-11-27 Thread Gregor Kobler (JIRA)
Problem to connect to database after standard installation
--

 Key: CORE-6454
 URL: http://tracker.firebirdsql.org/browse/CORE-6454
 Project: Firebird Core
  Issue Type: Bug
  Components: Installation
Affects Versions: 3.0.7
 Environment: Windows 10 x64
Reporter: Gregor Kobler
Priority: Minor


Hello

I have the problem that after installing the FB-Server, no connection can be 
established to it.

The following message appears:
Install incomplete, please read the Compatibility chapter in the release notes 
for this version.

If you double-click the installation program, the UAC appears and asks for 
admin rights. If you click on Yes, the installation will continue without 
errors. The FB service will run afterwards, but unfortunately you cannot 
connect to it. But if you start the installation by right-clicking the mouse 
and selecting "Run as Administrator", the UAC will appear and answer "Yes", the 
installation will be executed like the first time. But afterwards the 
connection to the database works.

So does anyone have any idea why it makes a difference if you double click or 
right click the installer and then "run as administrator"? In my opinion it 
shouldn't make a difference if the logged in user has admin rights.

Normally I use in my Inno Setup project, the following parameters for a silent 
installation "/SP- /VERYSILENT /NORESTART", then the default password 
"masterkey" should be set for the SYSDBA user. Even if you run the installation 
program normally, you will be asked for the SYSDBA password. It is not possible 
to do both, if you start the installation program only by double-clicking. The 
installation only works correctly if you select right mouse button and "run as 
administrator". I have only seen this behavior on a few PCs and these were 
managed by a central IT department (e.g. a university)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6453) EXECUTE STATEMENT fails on FB 4.x if containing time/timestamp with time zone parameters

2020-11-25 Thread Adriano dos Santos Fernandes (JIRA)
EXECUTE STATEMENT fails on FB 4.x if containing time/timestamp with time zone 
parameters


 Key: CORE-6453
 URL: http://tracker.firebirdsql.org/browse/CORE-6453
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 4.0 Beta 2
Reporter: Adriano dos Santos Fernandes


Please look at this:
===
set heading off;
set term ^;
execute block returns(sttm varchar(100), result varchar(100)) as
begin
   /*
sttm = 'select --#EDS#TAG#' || v_lf
   || 'current_time' || v_lf
   || 'from rdb$database'
;
*/
-- sttm = 'select 123 from rdb$database'; -- OK
-- sttm = 'select ''foo'' from rdb$database'; -- OK
-- sttm = 'select current_date from rdb$database'; -- OK
-- sttm = 'select 123456789012345678901234567890 from rdb$database'; -- OK 
(but only in 4.0 because this is greater than max bigint)
-- sttm = 'select cast(current_timestamp as timestamp) from rdb$database'; 
-- OK

-- sttm = 'select current_time from rdb$database';
sttm = 'select current_timestamp from rdb$database';


execute statement sttm into result;
suspend;
end
^
set term ;^
===

These two cases:
-- sttm = 'select current_time from rdb$database';
sttm = 'select current_timestamp from rdb$database';

-- lead to fail with
=
Statement failed, SQLSTATE = 07002
Dynamic SQL Error
-SQLDA error
-Data type unknown
-at SQLVAR index 0
=

No such problem in FB 3.x, and I could not find anything about this in 
README.incompatibilities.3to4.txt 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6450) Races in cache of opened security databases

2020-11-18 Thread Alexander Peshkov (JIRA)
Races in cache of opened security databases
---

 Key: CORE-6450
 URL: http://tracker.firebirdsql.org/browse/CORE-6450
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.7, 3.0.6, 4.0 Beta 2
Reporter: Alexander Peshkov


When new sec db is added to cache there is small timeframe when empty covering, 
already added to the list of known DBs, is not locked. An attempt to use it 
caused segfault when running tests on FB4 but same may happen for 3.0.6 & 3.0.7.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6449) Selectable store procedure return inserted values - join not working in FB3

2020-11-18 Thread Tomas Beran (JIRA)
Selectable store procedure return inserted values - join not working in FB3
---

 Key: CORE-6449
 URL: http://tracker.firebirdsql.org/browse/CORE-6449
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.6
Reporter: Tomas Beran


I have stored procedure where I insert data to table and returning primary key 
of inserted data. 
When I write select * from PROCEDURE P left outer join TABLE T on T.PK = P.PK 
then in Firebird 3.0.6 T is null, but in 2.5 T containg inserted data 

When I create sql query in the same transaction to TABLE T - data is returned

example:

set term ^;
create table TEST_TABLE (
  PKID  integer,
  TEXT  varchar(10),
constraint TEST_TABLE_PKID primary key (PKID))^

create or alter procedure TEST_PROCEDURE (text varchar(10))
returns (PKID integer)
as
begin
  select coalesce (max(PKID), 0) + 1
from TEST_TABLE
into :pkid;

  insert into TEST_TABLE (PKID, TEXT) values (:pkid, :text);
  
  suspend;
end
^
set term ;^ 


this query in FB 3.0.6 return null but in 2.5.9 return Hi
select T.TEXT
from TEST_PROCEDURE('Hi') P
left outer join TEST_TABLE T on T.PKID = P.PKID;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6447) SET SQLDA_DISPLAY ON: different text of message for parameterized expression starting from second run

2020-11-16 Thread Pavel Zotov (JIRA)
SET SQLDA_DISPLAY ON: different text of message for parameterized expression 
starting from second run
-

 Key: CORE-6447
 URL: http://tracker.firebirdsql.org/browse/CORE-6447
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine, ISQL
Affects Versions: 3.0.7, 4.0 Beta 2
Reporter: Pavel Zotov


Following statement produces same SQLSTATE but different text of message since 
2nd run:

SQL> set sqlda_display on;
SQL> select 1 from rdb$fields where current_timestamp = ? and current_time = ?;
. . .
Statement failed, SQLSTATE = 07002
Dynamic SQL Error
-SQLDA error
-No SQLDA for input values provided <<<<<<<<<<<<<< [ 1 ]
 
 
SQL> select 1 from rdb$fields where current_timestamp = ? and current_time = ?;
. . .
Statement failed, SQLSTATE = 07002
Dynamic SQL Error
-SQLDA error
-Wrong number of parameters (expected 2, got 0) <<<<<<<<<<< [ 2 ]



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6446) CLOOP envelopes is wrong in IStatus

2020-11-16 Thread Dimitry Sibiryakov (JIRA)
CLOOP envelopes is wrong in IStatus
---

 Key: CORE-6446
 URL: http://tracker.firebirdsql.org/browse/CORE-6446
 Project: Firebird Core
  Issue Type: Bug
  Components: API / Client Library
Reporter: Dimitry Sibiryakov


If CLOOP envelope in IStatusImpl::getErrors()/getWarnings() catch an exception 
it returns null pointer and crash the engine.
It should return pointer to a static array the same as 
BaseStatusWrapper::catchException().

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6445) Regression in FB 4.x when PSQL code has recursive SP calls: crash instead of SQLSTATE = 54001 ("Too many concurrent executions...")

2020-11-14 Thread Pavel Zotov (JIRA)
Regression in FB 4.x when PSQL code has recursive SP calls: crash instead of 
SQLSTATE = 54001 ("Too many concurrent executions...")
---

 Key: CORE-6445
 URL: http://tracker.firebirdsql.org/browse/CORE-6445
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Reporter: Pavel Zotov


Run following code:
===
SET BAIL ON;
shell del c:\temp\tmp4test.fdb 2>nul;
create database 'localhost:c:\temp\tmp4test.fdb' user 'SYSDBA' password 
'masterkey';
commit;

set term ^;
create or alter procedure sp_level_0 as
begin
end
^

create or alter procedure sp_level_2 as
begin
execute procedure sp_level_0;
end
^

create or alter procedure sp_level_1 as
begin
execute procedure sp_level_2;
end
^

alter procedure sp_level_0 as
begin
execute procedure sp_level_1;
end
^

set term ;^
commit;

connect 'localhost:c:\temp\tmp4test.fdb' user 'SYSDBA' password 'masterkey';
set echo on;
execute procedure sp_level_1;
rollback;
==

On 4.0.0.2265 out will be:
=
execute procedure sp_level_1;
Statement failed, SQLSTATE = 08006
Error reading data from the connection.
=

Expected (and got on FB 2.5.9.27152 and 3.0.8.33390):
=
execute procedure sp_level_1;
Statement failed, SQLSTATE = 54001
Too many concurrent executions of the same request
-At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedur...

Stack traces are in attached .7z files.

PS.

And one more issue.
Every odd (or even ?) run of this code leads to crash NOT instantly but after 
~30 seconds. This occurs regardless whether i restart FB service before it or 
no.
This is log of console when output was provided with timestamps by mtee.exe 
utility:

run-1:

23:33:43.324 execute procedure sp_level_1;
23:33:43.937 Statement failed, SQLSTATE = 08006
23:33:43.938 Error reading data from the connection.

run-2:

23:33:58.673 execute procedure sp_level_1;
23:34:25.133 Statement failed, SQLSTATE = 08006
23:34:25.133 Error reading data from the connection.

run-3:

23:34:42.804 execute procedure sp_level_1;
23:34:43.629 Statement failed, SQLSTATE = 08006
23:34:43.629 Error reading data from the connection.

run-4:

23:34:52.307 execute procedure sp_level_1;
23:35:18.839 Statement failed, SQLSTATE = 08006
23:35:18.839 Error reading data from the connection.

PPS.

firebird.conf:

AuthClient = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
AuthServer = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
BugCheckAbort = 1
DefaultDbCachePages = 2
ExtConnPoolLifeTime = 10
ExtConnPoolSize = 10
ExternalFileAccess = Full
FileSystemCacheThreshold = 65536K
IpcName = fb40_SS
KeyHolderPlugin = KeyHolder
LockHashSlots = 22111
LockMemSize = 5M
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
ReadConsistency = 0
RemoteServicePort = 3400
ServerMode = Super
TempBlockSize = 2M
TempCacheLimit = 2147483647
TempDirectories = d:\temp
UDFAccess = Restrict UDF
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6444) Ability to query Firebird configuration using SQL

2020-11-11 Thread Vlad Khorsun (JIRA)
Ability to query Firebird configuration using SQL
-

 Key: CORE-6444
 URL: http://tracker.firebirdsql.org/browse/CORE-6444
 Project: Firebird Core
  Issue Type: New Feature
  Components: Engine
Reporter: Vlad Khorsun


It will be nice to have ability to query configuration settings using SQL 
language.
Configuration here is contents of firebird.conf, databases.conf and settings 
passed via DPB when applicable.

Proposed solution is to introduce new virtual table to expose settings values. 
Table defined as

CREATE TABLE RDB$CONFIG 
(
RDB$CONFIG_ID   INTEGER NOT NULL,
RDB$CONFIG_NAME VARCHAR(63) CHARACTER SET UTF8 NOT NULL,
RDB$CONFIG_VALUEVARCHAR(255) CHARACTER SET UTF8,
RDB$CONFIG_DEFAULT  VARCHAR(255) CHARACTER SET UTF8,
RDB$CONFIG_IS_SET   BOOLEAN NOT NULL,
RDB$CONFIG_SOURCE   VARCHAR(255) CHARACTER SET UTF8
);

where
- RDB$CONFIG_ID 
  unique row identifier, no special meaning
   
- RDB$CONFIG_NAME  
  setting name, such as "DefaultDbCachePages", "TempCacheLimit" and so on

- RDB$CONFIG_VALUE
  actual value of setting, could be set in configuration and, if necessary, 
"fixed" by the engine (in case of wrong value)

- RDB$CONFIG_DEFAULT
  default value of setting, fixed at Firebird code

- RDB$CONFIG_IS_SET
  TRUE, if value was set by user

- RDB$CONFIG_SOURCE
  name of configuration file where setting was set, relative to the firebird 
root folder, for example: "firebird.conf", "databases.conf"
  or special value "DPB" if setting was set in DPB,
  If setting value was not set, this field contains NULL  

Table RDB$CONFIG is populated from in-memory structures when required and 
instance is kept at SQL query level.
For security reasons access is allowed to the SYSDBA/OWNER only (it could be 
changed before release).
Non-privileged user see empty content, no error is raised (also could be 
changed).


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6443) UDF Plugin will crash Firebird at linux

2020-11-11 Thread Sorien (JIRA)
UDF Plugin will crash Firebird at linux 


 Key: CORE-6443
 URL: http://tracker.firebirdsql.org/browse/CORE-6443
 Project: Firebird Core
  Issue Type: Bug
Affects Versions: 3.0.7
 Environment: Linux debian 10
Reporter: Sorien


Windows works fine

DECLARE EXTERNAL FUNCTION FILE_STORE
BLOB,
VARCHAR(300) BY DESCRIPTOR
RETURNS 
INTEGER BY VALUE
ENTRY_POINT 'file_store' MODULE_NAME 'storage';

udf part

bool isnull(const paramdsc* v)
{
return !v || !v->dsc_address || (v->dsc_flags & DSC_null);
}

extern "C" FB_DLL_EXPORT int file_store(blobcallback* sourceBlob, const 
paramdsc* sFileName)
{
if (isnull(sFileName)) { // <- will crash here 
return -1;
}

ISC_UCHAR* text = 0;
int len = get_any_string_type(sFileName, text);


if (!sourceBlob->blob_handle) {
return -1;
}

char* name = null_terminated_string(text, len);

makePath(splitFilename(name));

FILE *fp;
ISC_UCHAR *pbuffer;
ISC_USHORT length, actual_length;

fp = fopen(name, "w");
if (fp == NULL) {
free(name);
return errno;
}

length = sourceBlob->blob_max_segment + 1L;
pbuffer = (ISC_UCHAR *)malloc(length);

while ((*sourceBlob->blob_get_segment) (sourceBlob->blob_handle, 
pbuffer, length, _length)) {
if (fwrite(pbuffer, actual_length, 1, fp) != 1) {
return errno;
}
}

free(name);
fclose(fp);
free(pbuffer);
return 0;
}

it srashes also when i try to replace VARCHAR(300) BY DESCRIPTOR with CString

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6442) Massive Update force Deadlocks

2020-11-10 Thread Andreas Steibl (JIRA)
Massive Update force Deadlocks
--

 Key: CORE-6442
 URL: http://tracker.firebirdsql.org/browse/CORE-6442
 Project: Firebird Core
  Issue Type: Bug
  Components: API / Client Library
Affects Versions: 3.0.6
Reporter: Andreas Steibl


I use two instance of my simple application which make simultan updates to a 
Table.

for i:=1 to 1 do begin
  Create Query 
  Create Transaction with "read_commited, wait"
  UPDATE TEST SET VALUE = 1 WHERE ID = 1
  Commit Transaction
  Close Query
end;

If i start two instances and make these massive updates, i get a deadlock.

if i start instance 1 with 1 updates, and instance 2 with 1000 updates, i 
get no error, only if i start both instances with at leats 1 updates.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6441) Srp plugin keeps connection after database has been removed for ~10 seconds (SS and SC).

2020-11-09 Thread Pavel Zotov (JIRA)
Srp plugin keeps connection after database has been removed  for ~10 seconds 
(SS and SC).
-

 Key: CORE-6441
 URL: http://tracker.firebirdsql.org/browse/CORE-6441
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Reporter: Pavel Zotov
 Attachments: srp-cached-conn-after-drop-db-with-fixed-name.bat.7z, 
srp-cached-conn-after-drop-db-with-random-name.bat.7z

Bug was encountered while implementing test for CORE-6412.
After discuss with Alex, it was decided to create seperate ticket.

Consider scenario:
0) choose some name for database file; REMOVE this file if it exists

LOOP:
1) create database which are self-security;
2) create user SYSDBA in this database, suing plugin Srp;
3) run ISQL and connect to this DB using TCP protocol, and do some trivial 
query (say, to mon$ tables).  Send STDERR to separate file.
4) exit from ISQL and change state of this DB to full shutdown. Send STDERR to 
separate file (as on previous step; wil accumulating).
5) if size of STDERR log is greater than 0 - display its content and leave from 
scenario; otherwise:
6) check attributes from DB header. Line must contain 'full shutdown'
7) REMOVE DATABASE FILE from disk (it always will be successful because of full 
shutdown state)
8) make some pause, for ~10 seconds
9)  LOOP to step "1)".

Run this scenario on SS or SC.
It will run infinitely.  So far - so  good.

Now reduce pause (see step "8") from 10s to some shorter value, say 4 seconds.
Script will perform successfully only FIRST iteration.

On *second* iteration it will raise:
=
Statement failed, SQLSTATE = 08006
Error occurred during login, please check server firebird.log for details
=

And in firebird.log we can see:
=
Srp Server
connection shutdown
Database is shutdown.
=

So, we can not create database when it surely does not exist.
Moreover, we can not create DB with RANDOM name also, not just with "fixed" one 
(it can be easy checked by assigning to variable !dbnm! something like: set 
dbnm=c:\temp\tmp4test_!random!.fdb )

Attachments:
srp-cached-conn-after-drop-db-with-fixed-name.bat.7z - when trying to operate 
with the same DB file on each iter;
srp-cached-conn-after-drop-db-with-random-name.bat.7z  -- when DB file is 
random on each iter.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-6440) Expression indexes w/ "coalesce" within the expression not working after migration from firebird 2.5.x to firebird 3.0.x

2020-11-09 Thread Everton Miyabukuro (JIRA)
Expression indexes w/ "coalesce" within the expression not working after 
migration from firebird 2.5.x to firebird 3.0.x


 Key: CORE-6440
 URL: http://tracker.firebirdsql.org/browse/CORE-6440
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 3.0.7, 3.0.6
 Environment: Windows 8.1
Reporter: Everton Miyabukuro
Priority: Minor


After migrating a database from Firebird 2.5.8 to Firebird 3.0.6 (tested with 
firebird 3.0.7 as well), expression indexes with a "coalesce" within the 
expression stopped being used in queries. Only after dropping and recreating 
the affected indexes they where picked up by the optimizer. Recomputing the 
selectivity for the index had not effect. Expression indexes with expressions 
other than coalesce (e.g. "upper()") worked properly.

Test case:
Create the following database in firebird 2.5.8:
CREATE DATABASE '127.0.0.1:c:\test.fdb'
USER 'SYSDBA'
PAGE_SIZE 16384
DEFAULT CHARACTER SET WIN1252 COLLATION WIN_PTBR;

CREATE TABLE TEST (
FIELD_1  INTEGER NOT NULL,
FIELD_2  VARCHAR(50) CHARACTER SET WIN1252 COLLATE WIN_PTBR,
FIELD_3  VARCHAR(50) CHARACTER SET WIN1252 COLLATE WIN_PTBR
);

INSERT INTO TEST (FIELD_1, FIELD_2, FIELD_3) VALUES (1, 'TEST1', 'TEST1_1');
INSERT INTO TEST (FIELD_1, FIELD_2, FIELD_3) VALUES (2, 'TEST2', 'TEST2_2');

COMMIT WORK;

ALTER TABLE TEST ADD CONSTRAINT PK_TEST PRIMARY KEY (FIELD_1);

CREATE INDEX TEST_IDX1 ON TEST COMPUTED BY 
(UPPER(COALESCE(FIELD_2,''))||UPPER(COALESCE(FIELD_3,'')));
CREATE INDEX TEST_IDX2 ON TEST COMPUTED BY (UPPER(FIELD_2)||UPPER(FIELD_3));
CREATE INDEX TEST_IDX3 ON TEST COMPUTED BY (UPPER(COALESCE(FIELD_2,'')));
CREATE INDEX TEST_IDX4 ON TEST COMPUTED BY (UPPER(FIELD_2));

Backup this database in firebird 2.5.8, restore in firebird 3.0.6 or firebird 
3.0.7. 
Then execute the following selects:

--Uses a proper index: PLAN (TEST INDEX (PK_TEST))
select * from test where field_1 = 1

--Uses a proper index: PLAN (TEST INDEX (TEST_IDX4))
select * from test where (UPPER(FIELD_2)) = 'TEST1'

--Doesn't uses a proper index: PLAN (TEST NATURAL)
select * from test where (UPPER(COALESCE(FIELD_2,''))) = 'TEST1'

--Uses PLAN (TEST INDEX (TEST_IDX2))
select * from test where (UPPER(FIELD_2)||UPPER(FIELD_3)) = 'TEST1TEST1_1'

--Doesn't uses a proper index: PLAN (TEST NATURAL)
select * from test where 
(UPPER(COALESCE(FIELD_2,''))||UPPER(COALESCE(FIELD_3,''))) = 'TEST1TEST1_1'


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


  1   2   3   4   5   6   7   8   9   10   >