[firebird-support] Get check constraints info
Hi, I need to get a check constraints info, listing column names. I do: SELECT * FROM rdb$triggers trg JOIN rdb$check_constraints chk_k ON trg.rdb$trigger_name = chk_k.rdb$trigger_name WHERE trg.rdb$relation_name = 'SCHEMA_AUTHOR' AND trg.rdb$trigger_type = 1 But I need the column names to which affect. How I have to do the sql? -- Maxi b: http://maxirobaina.tumblr.com t: http://twitter.com/maxirobaina
[firebird-support] datetime trunc
Hi, Is there an equivalent function to trunc datetime fields in firebird ? Something like date_trunc in postgre [1] -- Maxi [1] http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC
Re: [firebird-support] Restart and stop Firebird 2.5.2 on Linux
De: jorgebj Para: firebird-support@yahoogroups.com Enviado: viernes, 5 de abril de 2013 19:17 Asunto: [firebird-support] Restart and stop Firebird 2.5.2 on Linux Hello everyone: How to restart and stop Firebird 2.5.2 on Linux? No rebooting the server. In version 2.1 of FireBird the command fbmgr was used to stop and restart Firebird. In Firebird 2.5.2 command no longer exists fbmgr.bin Thanks for your help --- Hi Jorge, I suppose It depend on which distro you are. On Ubuntu I do: sudo service firebird2.5-super restart Or sudo service firebird2.5-super stop sudo service firebird2.5-super start Regards
Re: [firebird-support] alter column drop default (firebird 2.x)
El mar, 17-01-2012 a las 14:27 +0100, Thomas Steinmaurer escribió: > > > If I want to drop a column-level default, in firebird 2.x I can do > > > > ALTER TABLE tablename ALTER [COLUMN] colname DROP DEFAULT > > > > But, if [COLUMN] has not a default value setting, that statement > raise > > an error. > > The question is, How can I to know if a field has set a default > value? > > > > Query against system tables? Which one? > > The following gives you all fields for a given relation and a > separate > field if the field has a default value. Change the query for your > needs. > > select > rf.rdb$relation_name > , rf.rdb$field_name > , case > when f.rdb$default_value is not null then 1 else 0 > end has_default > from > rdb$fields f join rdb$relation_fields rf on f.rdb$field_name = > rf.rdb$field_source > where > rf.rdb$relation_name = > > Hope this helps. What is the difference between rdb$relation_fields.default_value and rdb $fields.default_value ? Regards. Maxi.
[firebird-support] alter column drop default (firebird 2.x)
Hi, If I want to drop a column-level default, in firebird 2.x I can do ALTER TABLE tablename ALTER [COLUMN] colname DROP DEFAULT But, if [COLUMN] has not a default value setting, that statement raise an error. The question is, How can I to know if a field has set a default value? Query against system tables? Which one? Thanks in advance Maxi.
[firebird-support] String overflow
Hi, I'm a little bit confuse here. This select statement raise this error: SELECT COUNT(*) FROM "AFILIADO" INNER JOIN "PERSONA" ON ("AFILIADO"."PER_ID" = "PERSONA"."PER_ID") WHERE "PERSONA"."FULL_NAME" CONTAINING '0' -802L, 'String overflow: value 137 bytes long cannot fit in character field of maximum length 111 Obviously, FULL_NAME is a varchar(111). This select statement is part of a django (python) project. I'm using django-firebird built on top of kinterbasdb. The production server is a Windows 2003 Server with Firebird 2.1 SS. But, if I run this select, for example, using FlameRobin I don't get that error. Also, I test this in my laptop with Ubuntu 11.04 and Firebird 2.5 with the same result. What can be wrong? Any help will be appreciated. Thanks in advance. --- Maxi.
Re: [firebird-support] Error on restore FB2.1 backup into FB2.5
El jue, 06-10-2011 a las 14:10 +1300, Helen Borrie escribió: > > At 12:52 PM 6/10/2011, Maximiliano Robaina wrote: > >> > > >> >What could be the problem ? > >> > >> > http://www.firebirdsql.org/file/documentation/release_notes/html/rlsnotes251.html#rnfb25-utils-gbak-fix01 > >> > >> ./hb > > > >Hi Helen, > >Thanks for the tip, it works fine although the doc wasn't very clear > for > >me. Apparently, the problem was when trying to restore a stored > >procedure > >BTW, Why might this have happened? > > The source text of stored procs (and several other types of object, > such as CHECK constraints) is stored in a blob, as is the "compiled" > BLR code. When you restore a database, the BLR is not recreated: the > same BLR is used until next time you recreate or alter the object. > > Historically, the engine did not do the right thing regarding the > transliteration of strings embedded in the source and the BLR. In > v.2.1 and 2.5 a lot of work was done to address the international > language issues, as you probably know. A side effect of this was that > everything that was read from data and metadata became subject to > "well-formedness" checks. Hence, on restoring, those previously stored > source and BLR objects are throwing "malformed string" errors when > gbak tries to read and write the data in these system table records. > This very old bug affects user blobs, too, if they have been stored > using character set NONE and the client is configured to read a > specified character set to which the stored data could not be > transliterated. > > In v.2.1 there were scripts in ../misc that you could run to repair > the metadata blobs and also use as a template for repairing the > similar errors in blobs in your user data. The repair switches were > added to the gbak restore code in v.2.5 to do the same corrections to > metadata and data, respectively, during the process of restoring a > database for upgrade. > > ./heLen Very clear explanation ! Thanks a lot. --- Maxi
Re: [firebird-support] Error on restore FB2.1 backup into FB2.5
El jue, 06-10-2011 a las 11:47 +1300, Helen Borrie escribió: > > At 11:33 AM 6/10/2011, Maximiliano Robaina wrote: > >Hi, > > > >I'm trying to restore a firebird 2.1 SS backup into a firebird 2.5 SS > >machine on Ubuntu 11.04 desktop using flamerobin but I get the next > >error: > > > >Database restore canceled 19:28:52 due to IBPP exception: > > > >*** IBPP::SQLException *** > >Context: ServiceImpl::Wait > >Message: isc_service_query failed > > > >SQL Message : -104 > >Invalid token > > > >Engine Code : 335544849 > >Engine Message : > >Malformed string > > > > > >What could be the problem ? > > http://www.firebirdsql.org/file/documentation/release_notes/html/rlsnotes251.html#rnfb25-utils-gbak-fix01 > > ./hb Hi Helen, Thanks for the tip, it works fine although the doc wasn't very clear for me. Apparently, the problem was when trying to restore a stored procedure BTW, Why might this have happened? Regards.
[firebird-support] Error on restore FB2.1 backup into FB2.5
Hi, I'm trying to restore a firebird 2.1 SS backup into a firebird 2.5 SS machine on Ubuntu 11.04 desktop using flamerobin but I get the next error: Database restore canceled 19:28:52 due to IBPP exception: *** IBPP::SQLException *** Context: ServiceImpl::Wait Message: isc_service_query failed SQL Message : -104 Invalid token Engine Code: 335544849 Engine Message : Malformed string What could be the problem ? Thanks in advance. --- Maxi.
[firebird-support] Set / Drop default: update related field domain or DDL statement
Hi, I can't understand at all, about how set/drop default update the system tables against doing an alter domain of the related field which I want to change. (I'm looking into RDB$RELATION_FIELDS) Using: ALTER TABLE MY_TABLE ALTER COLUMN MY_FIELD SET DEFAULT 'X' The RDB$RELATION_FIELDS table update RDB$DEFAULT_VALUE and RDB $DEFAULT_SOURCE. (Idem if I do a DROP DEFAULT) BTW, over a existent filed, if I want to change the default value I can do ALTER DOMAIN RDB$xxx SET/DROP DEFAULT, but the RDB$RELATION_FIELDS doesn't change the same fields like ALTER TABLE... does. Notice what ALTER TABLE MY_TABLE ALTER COLUMN MY_FIELD DROP DEFAULT statement raise an error if there isn't a default specification on MY_FIELD and ALTER DOMAIN... doesn't. Then, the question is, what is the correct approach for use SET/DROP default? Can I use either one or the other indifferently? I hope I was clear. Thanks in advance. --- Maxi.