Re: [firebird-support] Re: FB 2.5.4 - new handling of IN SUBSELECT?

2015-11-06 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
On 5.11.2015 13:25, Dmitry Yemanov dim...@users.sourceforge.net [firebird-support] wrote: > > 05.11.2015 14:12, Josef Kokeš j.ko...@apatykaservis.cz wrote: > > > > I wonder: Was there any change in FB 2.5.4 which would slow down > > processing of WHERE field IN (subselec

Re: [firebird-support] FB 2.5.4 - new handling of IN SUBSELECT?

2015-11-06 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
On 5.11.2015 19:38, setysvar setys...@gmail.com [firebird-support] wrote: > > Den 05.11.2015 12:12, skrev Josef Kokeš j.ko...@apatykaservis.cz > [firebird-support]: > > SELECT COUNT(*) > > FROM a_complex_view > > WHERE field1=1 AND field2<>2 > >

[firebird-support] FB 2.5.4 - new handling of IN SUBSELECT?

2015-11-05 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! I wonder: Was there any change in FB 2.5.4 which would slow down processing of WHERE field IN (subselect) a lot, compared to FB 2.5.3? I have been performing tests because a user of mine complained about slow speed of my database, and found out that my query in the form of: SELECT

[firebird-support] GBAK - validation error for column X, value *** null ***

2015-05-15 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! What would be a proper way of dealing with GBAK restore error 'validation error for column X, value *** null ***'? This error appears in one table, where X is the primary key. The database is Firebird 2.5.4 in the superserver mode. 1) How do I properly restore this backup? Neither

Re: [firebird-support] GBAK - validation error for column X, value *** null ***

2015-05-15 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! Thanks for the answer. Luckily, I still have the FDB file, so I can get rid of the bad records easily. What has me concerned is, what if I only had the backup? Your trick with pumping seems plausible, I will have to give it a try. IBBackupSurgeon looks promising, too. Josef On 15.5.2015

[firebird-support] Request depth exceeded problem

2014-12-29 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! I am having trouble with one installation of my application: Whenever I try to create a table, I receive error 335544351 unsuccessful metadata update\nrequest depth exceeded. (Recursive definition?). I cannot figure what could possibly be causing this, as the CREATE TABLE statement is

Re: [firebird-support] PSQL: Getting both aggregation and individual rows

2014-10-27 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
On 21.10.2014 20:48, 'Edward Mendez' emendez...@nc.rr.com [firebird-support] wrote: Josef, Not sure if this will be efficient depending on number of rows, but this is another way without using a TEMP_TABLE. SELECT gen_data.id, gen_data.name, gen_data.dateandtime, gen_data.value,

Re: [firebird-support] PSQL: Getting both aggregation and individual rows

2014-10-27 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! I tried this approach before, but it violates my only run GET_DATA once requirement :-( Josef On 21.10.2014 21:15, Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support] wrote: What about FOR WITH TMP(MyDateTime, MySum) as (SELECT MIN(dateandtime),

Re: [firebird-support] PSQL: Getting both aggregation and individual rows

2014-10-27 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
On 27.10.2014 10:35, Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support] wrote: Hi! I tried this approach before, but it violates my only run GET_DATA once requirement :-( Well, with EXECUTE BLOCK and ORDER BY it may be possible to satisfy your MIN

[firebird-support] PSQL: Getting both aggregation and individual rows

2014-10-21 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Hi! Is there a simple way to get an aggregation of some query as well as the individual rows from within a PSQL? I.e., I have a stored procedure GEN_DATA which produces individual rows (ID, Name, DateAndTime, Value). I am processing the output of GEN_DATA in another stored procedure PROCESS_DATA:

Re: [firebird-support] PSQL: Getting both aggregation and individual rows

2014-10-21 Thread Josef Kokeš j.ko...@apatykaservis.cz [firebird-support]
Seems like I will have to use a temporary table for this purpose. But if there is another way, I would be interested in knowing it. Josef Hi! Is there a simple way to get an aggregation of some query as well as the individual rows from within a PSQL? I.e., I have a stored procedure

Re: [firebird-support] Store Procedure for updating data, why it is need to commit?

2014-04-28 Thread Josef Kokeš
Hi guys, I have a simple stored procedure to update data, like this : SET TERM ^ ; CREATE PROCEDURE REG AS BEGIN UPDATE table a set a.field1 = '123'; exit; END^ SET TERM ; ^ When I run that procedure on flamerobin with this command: execute procedure Reg. It runs

[firebird-support] Efficient subselects

2014-04-18 Thread Josef Kokeš
Hi! I am struggling with a particular select, trying to get it to execute as efficiently as possible. I have tables MASTER(ID, NAME, ...) and DETAIL(ID, MASTER_ID, VALUE1, VALUE2, VALUE3). The SELECT I want to get would display all fields from MASTER and an aggregation of fields from DETAIL, e.g.

Re: [firebird-support] Efficient subselects

2014-04-18 Thread Josef Kokeš
I would consider the this second option, but I would change the join: SELECT ... FROM DETAIL LEFT JOIN MASTER Check on your real structure and data if it helps Hi! Unfortunately, this is not applicable to my case, as I do have MASTERs which have no DETAIL (yet). Josef

Re: [firebird-support] Efficient subselects

2014-04-18 Thread Josef Kokeš
On 18.4.2014 11:10, Thomas Beckmann wrote: Hi Josef, what I figured out to be quite handy, is to write something like: select MASTER.*, cast(left(S, 10) as bigint), cast(substring(S from 10 for 10) as bigint), cast(right(S, 10) as bigint), from (SELECT MASTER.ID, (SELECT

Re: [firebird-support] toggle betweenn 0 and 1

2014-04-02 Thread Josef Kokeš
On 2.4.2014 9:26, Bogdan Mihalache wrote: Update table set *column = Mod(column+1,2)* where id = :id UPDATE table SET column=1-column WHERE id=:id Doesn't need any functions, built-in or UDF. Josef Kokes

Re: [firebird-support] Performance Question

2013-09-11 Thread Josef Kokeš
Hello everybody, we plan a web-Application with a firebird database. Now I have two options to prepare the data for the web-client (HTML…). Option A – a view – returns Data from all Users and the client selects itself Option B – a stored procedure with input parameters, the client gets

[firebird-support] LEFT JOIN much faster than JOIN

2013-08-02 Thread Josef Kokeš
Hi! For a long time I have been using LEFT JOINs rather than JOINs everywhere, because of some past experience with Firebird 1.5 that LEFT JOIN is much faster than JOIN, even if I have to use WHERE key_of_the_joined_table IS NULL afterwards. Today I encountered a case where this is the case even

Re: [firebird-support] LEFT JOIN much faster than JOIN

2013-08-02 Thread Josef Kokeš
Hello Josef, I've never had that issue using Firebird, but some time ago I had a similar behavior with SQL Server and the responsible was a fragmented index. May be you should take a look to your indexes design or rebuild them via backup/restore. Hi! That should not be the case here, as

Re: [firebird-support] LEFT JOIN much faster than JOIN

2013-08-02 Thread Josef Kokeš
On 2.8.2013 13:59, Alexis Diel wrote: but LEFT JOIN is diferente of JOIN... - LEFT JOIN brings all the data filtered from the FROM table, and - JOIN brings only the data that have the ON condition in the JOINED table. Which should make JOIN faster than LEFT JOIN, if anything, because it

Re: [firebird-support] Rename a key through write to a system table

2013-07-18 Thread Josef Kokeš
On 18.7.2013 7:08, Josef Kokeš wrote: Hi! I realize that the official answer to can I rename an index is no, and that directly writing to the system tables is generally a poor idea. But still: How much damage can I cause by UPDATE on RDB$INDEX_NAME in RDB$INDICES and RDB$INDEX_SEGMENTS? I

Re: [firebird-support] How do return the number of object in a Firebird database

2013-07-17 Thread Josef Kokeš
On 17.7.2013 13:55, Softtech Support wrote: Greetings All, v1.5.3 I need to know how many tables, indicies, functions, stored procedures, etc are in my Firebird database. Is there a quick way to determine this? -- stored procedures SELECT COUNT(*) FROM rdb$procedures WHERE

[firebird-support] Rename a key through write to a system table

2013-07-17 Thread Josef Kokeš
Hi! I realize that the official answer to can I rename an index is no, and that directly writing to the system tables is generally a poor idea. But still: How much damage can I cause by UPDATE on RDB$INDEX_NAME in RDB$INDICES and RDB$INDEX_SEGMENTS? I have this itch I would like to scratch, where

Re: [firebird-support] NOT in Firebird

2013-07-04 Thread Josef Kokeš
On Thu, 4 Jul 2013 10:34:21 +0200, Olaf Kluge olaf.kl...@satron.de mailto:olaf.kluge%40satron.de wrote: for example there are two variables. Var1 = 0 Now I would like to negate the Var1 to Var2. If var1 = 0, then should Var2 = 1 and in the other direction. Ist it possible Var2 =

[firebird-support] Values of RDB$TRIGGERS.RDB$TRIGGER_TYPE

2013-03-22 Thread Josef Kokeš
Hi! I wonder, is there a documentation of the various RDB$TRIGGERS.RDB$TRIGGER_TYPE values somewhere? The Interbase 6 documentation (Language Reference, specifically) lists the values for the regular BEFORE/AFTER INSERT/UPDATE/DELETE, but I can't find values for multi-event triggers, e.g.

Re: [firebird-support] Values of RDB$TRIGGERS.RDB$TRIGGER_TYPE

2013-03-22 Thread Josef Kokeš
Hi! I wonder, is there a documentation of the various RDB$TRIGGERS.RDB$TRIGGER_TYPE values somewhere? The Interbase 6 documentation (Language Reference, specifically) lists the values for the regular BEFORE/AFTER INSERT/UPDATE/DELETE, but I can't find values for multi-event

Re: [firebird-support] Re: Values of RDB$TRIGGERS.RDB$TRIGGER_TYPE

2013-03-22 Thread Josef Kokeš
On 22.3.2013 16:13, Dmitry Yemanov wrote: 22.03.2013 18:44, Josef Kokeš wrote: I wonder, is there a documentation of the various RDB$TRIGGERS.RDB$TRIGGER_TYPE values somewhere? In your Firebird distribution: /doc/sql.extentions/README.universal_triggers Or the same file in the SVN

Re: [firebird-support] How to migrate to new database Server?

2013-02-12 Thread Josef Kokeš
1. Could I install Firebird2 64 bits on a database server and access to the database from 32 bits web application on another machine? Yes. 2. What is the process to convert Firebird 1.5 database to Firebird 2 database? Make a backup on the old (FB1.5) server. Uninstall the old server.

Re: [firebird-support] Some alternative to ZeBeDee?

2013-02-06 Thread Josef Kokeš
On 7.2.2013 7:04, W O wrote: Hello everybody In some articles I saw that people use ZeBeDee for Internet communication with Firebird, however that product seems discontinued since the year 2005. Do you know another software similar to ZeBeDee which works well with Firebird and it's free?

Re: [firebird-support] First query very slow

2013-02-04 Thread Josef Kokeš
1) Why do you group on something not an output field? I didn't think that was allowed. It is. I am not sure if it has any reasonable use, but it is possible. 2) LEFT JOIN followed by referencing to a field in the table being NOT NULL makes the LEFT JOIN in reality become a (inner) JOIN,

Re: RES: [firebird-support] Slow connection to firebird server with win 7- 32 bits machines

2013-02-04 Thread Josef Kokeš
The way I understood it, is each 32 bit process running on 64 bit windows can access a max of 2 gig each. So if you are running 3 memory intensive 32 bit applications they each be able to access a max of 2 gig, utilising a total of 6 gig? Correct. With my selection of applications, I prefer

Re: [firebird-support] Side by side install 2.1 and 2.5?

2013-01-30 Thread Josef Kokeš
On a Windows server with FB 2.1 I want to try using FB 2.5 for some purposes, so I want to do a side by side install of 2.5. The installer asks me to stop the existing 2.1 instances, so I suppose it cannot be done using the installer? Download the ZIP archive. Then read the file

Re: [firebird-support] Interbase/Firebird interaction?

2013-01-17 Thread Josef Kokeš
This raises a couple of questions: 1) Are there any adverse conflicts between IB6.5 and Firebird in a situation like this ... i.e., would running AT against an IB6.5 engine ultimately damage the data? I had some significant issues if I used FB to access an IB database file. It was imperative

[firebird-support] Create a role that has all rights for a database

2012-09-21 Thread Josef Kokeš
Hi! I have a database which was never intended to be used by more than one user, so it never concerned itself with access rights - basically, all objects were always created by that one user, who thus had a full access to them. Now I find myself in need of using another user (because I need

Re: [firebird-support] Get Installed Folder

2012-09-13 Thread Josef Kokeš
How can I get the folder where FireBird is installed. I use Delphi and I want to copy the UDF folder after a silent installation. Not sure if this is the best method, but I read the DefaultInstance registry key. It work for me for FB 1.5, 2.1 and 2.5: RootKey := HKEY_LOCAL_MACHINE;

[firebird-support] Unsuccessful metadata update,request depth exceeded

2012-09-13 Thread Josef Kokeš
Hi! This is a first for me. When creating a new table on one Firebird 2.5 installation, I am getting the following error: ISC ERROR CODE:335544351 ISC ERROR MESSAGE: unsuccessful metadata update request depth exceeded. (Recursive definition?) Statement: CREATE TABLE v9karty_log ( v9_klic

Re: [firebird-support] Establishing a database with Firebird

2012-09-03 Thread Josef Kokeš
My aims are (i) establishing a new database on the new computer and (ii) ensuring that the old records are safely transferred. My first question is whether Firebird 1.5.6 is compatible to Window 7. In addition, would Yes. Even Windows x64 are compatible with 32bit Firebird 1.5.6. Josef

[firebird-support] Known issues between FB2.5 and Windows XP Firewall?

2012-08-12 Thread Josef Kokeš
Hi! Are there some known issues between Firebird 2.5 (SuperServer, default install) and Windows Firewall (from WinXP)? Today is the second time I encountered some serious slowdowns while the XP's firewall was running which went away when I disabled the firewall - a simple query, which on

[firebird-support] UDF - reading BLOB length

2012-07-31 Thread Josef Kokeš
Hi! What could possibly be wrong with the following UDF? * Function * type TBlob = {packed} record GetSegment: TISC_BlobGetSegment; BlobHandle: PInt; SegmentCount: LongInt; MaxSegmentLength: LongInt; TotalSize: LongInt; PutSegment: TISC_BlobPutSegment; end;

Re: [firebird-support] UDF - reading BLOB length

2012-07-31 Thread Josef Kokeš
Nice - this will also fail with the same error: function BLOBLEN(Value: PBlob): Integer; cdecl; begin Result := 1; end; I admit I find this very mystifying. Josef Hi! What could possibly be wrong with the following UDF? * Function * type TBlob = {packed} record

Re: [firebird-support] UDF - reading BLOB length

2012-07-31 Thread Josef Kokeš
On 31.7.2012 14:12, Josef Kokeš wrote: Nice - this will also fail with the same error: function BLOBLEN(Value: PBlob): Integer; cdecl; begin Result := 1; end; I admit I find this very mystifying. Never mind, found it - the problem was not in the function, but in the SQL declaration

Re: [firebird-support] Perl, Firebird, and empty Where clause

2012-07-19 Thread Josef Kokeš
I'm trying to have an existing perl program, that is using the DBI system for theoretical database interoperability, to use Firebird. I've discovered that, as a standard, this program executes statements such as, select * from table where pkey='' That apparently works with Mysql - doing

[firebird-support] Firebird's default settings

2012-07-16 Thread Josef Kokeš
Hi! I have never tried to change Firebird's default settings, because the server has always been good enough and if it isn't broken, don't fix it. But I can't help but wonder about some of the settings, because I don't understand their default values. Specifically, assuming Firebird 2.5 in

Re: [firebird-support] Firebird's default settings

2012-07-16 Thread Josef Kokeš
The problem is that SuperServer is multi-threaded but not interlocked, so only one thread runs at a time so it cannot take advantage of multiple cores. Some operating systems move the process from one core to another in an attempt to balance load. That degrades performance, but can be

[firebird-support] Manipulating BLOBs in a x64 UDF compiled with Delphi XE2

2012-06-18 Thread Josef Kokeš
Hi! Having bought Delphi XE2, I tried to compile my old (well, very old) UDF in a 64bit mode. I expected a total fail, because the UDF was written in Delphi 5 for Interbase 6.0, but after I fixed string types, the UDF actually works with Firebird 2.1 x64. With one exception - a function which

Re: [firebird-support] Manipulating BLOBs in a x64 UDF compiled with Delphi XE2

2012-06-18 Thread Josef Kokeš
The function: function STRBLOB(Value: PAnsiChar; Dest: PBlob): PBlob; begin Result := Dest; Dest^.PutSegment(Dest^.BlobHandle, Value, StrLen(Value)) end; That's CDECL, too. I copied it from the implementation rather than from the interface. Josef Kokes

Re: [firebird-support] Manipulating BLOBs in a x64 UDF compiled with Delphi XE2

2012-06-18 Thread Josef Kokeš
Hi! Hello, Josef! Monday, June 18, 2012, 10:18:57 AM, you wrote: JK function STRBLOB(Value: PAnsiChar; Dest: PBlob): PBlob; cdecl Yeah, I realized too late that I should have used the declaration from interface, not from implementation. I have that. JK The blob record (probably wrong

[firebird-support] Getting database creation date programatically

2012-06-15 Thread Josef Kokeš
Hi! I need to find the date of last database restore. GSTAT -h can print this information as Creation date. Does anyone know how can I get this information programatically? Thanks, Pepak ++

Re: [firebird-support] Getting database creation date programatically

2012-06-15 Thread Josef Kokeš
On 15.6.2012 9:19, Thomas Steinmaurer wrote: I need to find the date of last database restore. GSTAT -h can print this information as Creation date. Does anyone know how can I get this information programatically? If monitoring tables are available, it might be easier to query MON$DATABASE

Re: [firebird-support] Getting database creation date programatically

2012-06-15 Thread Josef Kokeš
I need to find the date of last database restore. GSTAT -h can print this information as Creation date. Does anyone know how can I get this information programatically? If monitoring tables are available, it might be easier to query MON$DATABASE with e.g.: select mon$creation_date from

[firebird-support] Question about user rights and procedures

2012-04-12 Thread Josef Kokeš
Hi! I feel a bit overwhelmed by user rights in a database in respect to stored procedures. I have a database owned by user OWNER. I want to give limited access to user ATTACKER, so that he can read and write the database through a stored procedure MODIFY_DATABASE. So I grant: GRANT EXECUTE

Re: [firebird-support] Identifying damanged pages

2012-03-30 Thread Josef Kokeš
Dne 29.3.2012 18:26, Ann Harrison napsal(a): 2012/3/29 Josef Kokešj.ko...@apatykaservis.cz Due to hardware malfunction, my database got damaged. GFIX (-v -f -i) tells me that a database has 1 record level error, 9 data page errors, 41 index page errors and 322 database page errors.

[firebird-support] How to drop an inconsistent table

2012-02-24 Thread Josef Kokeš
Hi! This is a new one for me: I have a Firebird 2.5 database file with corruption not in records, but in table structures themselves. After I used GFIX -v -f, GFIX -m and backup/restore, I am left with a database which basically works, but as soon as I try to access certain tables, I get an

[firebird-support] Use of column aliases in a SELECT

2012-01-27 Thread Josef Kokeš
Hi! I find myself repeatedly writing code such as SELECT (a+b)*c AS value1, some_function((a+b)*c) AS value2, some_other_function((a+b)*c) AS value 3 FROM ... Is there any other way to reuse a calculated value by referencing its alias than through views? E.g. CREATE VIEW

Re: [firebird-support] Using FB another port than 3050

2012-01-25 Thread Josef Kokeš
Dne 25.1.2012 12:17, bennie_coetzer napsal(a): Hi, I am still battling with FB on another port. I have changed the firebird.conf file to use port 3051. This seems to work as the port is actively monitored when FB runs and not when it is stopped.I then used FlameRobin and created a host

[firebird-support] Converting BLOB to long VARCHAR

2011-12-28 Thread Josef Kokeš
Hi! I am trying to convert a BLOB (unlimited size, theoretically) to a long VARCHAR (say, VARCHAR(8192)). This should be easy enough to do: DECLARE VARIABLE b BLOB; /* input */ DECLARE VARIABLE v VARCHAR(8192); /* output */ ... v = SUBSTRING(b, 1, 8192); Except that as soon as I convert

Re: [firebird-support] Converting BLOB to long VARCHAR

2011-12-28 Thread Josef Kokeš
Dne 28.12.2011 17:21, Milan Babuskov napsal(a): Josef Kokeš wrote: I am trying to convert a BLOB (unlimited size, theoretically) to a long VARCHAR (say, VARCHAR(8192)). This should be easy enough to do: DECLARE VARIABLE b BLOB; /* input */ Which subtype of BLOB? IIRC, BLOB subtype 1 (text

Re: [firebird-support] Fast massive delete with complex criteria

2011-12-27 Thread Josef Kokeš
I find myself in a situation where I need to delete large amount of data from a huge (comparably) table, with relatively complex criteria on what stays and what gets deleted: - The table in question has about 6 million rows. - The rows contain a mix of integer, timestamp and blob columns,

[firebird-support] Fast massive delete with complex criteria

2011-12-27 Thread Josef Kokeš
Hi! I find myself in a situation where I need to delete large amount of data from a huge (comparably) table, with relatively complex criteria on what stays and what gets deleted: - The table in question has about 6 million rows. - The rows contain a mix of integer, timestamp and blob columns,

[firebird-support] PL/SQL vs nonexistent UDF

2011-12-22 Thread Josef Kokeš
Hi! Is it possible do declare a stored procedure which would use a non-existent external function? That is, I can define an external function using: declare external function test returns integer entry_point 'TEST' module_name 'pepak.dll' This will succeed even if pepak.dll does not

[firebird-support] Order of rows returned by stored procedures

2011-12-07 Thread Josef Kokeš
Hi! It's been my experience that if I have a stored procedure which returns rows in a particular order and perform a SELECT on this procedure, the row order of the SELECT matches that of the procedure. E.g.: CREATE PROCEDURE test RETURNS ( value INTEGER ) AS BEGIN value = 1; SUSPEND;

Re: [firebird-support] Order of rows returned by stored procedures

2011-12-07 Thread Josef Kokeš
It's been my experience that if I have a stored procedure which returns rows in a particular order and perform a SELECT on this procedure, the row order of the SELECT matches that of the procedure. E.g.: What I would like to know, is this behavior documented or is it just a random

Re: [firebird-support] Great variance in speed of an INSERT INTO ... SELECT

2011-10-20 Thread Josef Kokeš
OK, then we'll need to look for less common problems. When the query is slow, are you seeing lots of page faults? Process size growth? What is the rate of reads/writes/marks/fetches? Do you have any guess as to where the time is going? Hi Ann, I am afraid most of the values you are asking me

Re: [firebird-support] UDF

2011-08-23 Thread Josef Kokeš
Hello, this is related to my previous post... I'm trying to write a UDF in Delphi... It's declared like this: function Descuentos(var Suma:currency;Descuentos:pchar):double; cdecl; export; DECLARE EXTERNAL FUNCTION SG_DES DOUBLE PRECISION, CSTRING(50) RETURNS DOUBLE PRECISION BY VALUE