Last active
November 10, 2018 10:58
-
-
Save martinusso/9006260 to your computer and use it in GitHub Desktop.
Playing with Firebird System Tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [en] select primary key field of all tables | |
-- [pt] selecionar o campo primary key das tabelas | |
select | |
i.rdb$index_name, | |
s.rdb$field_name | |
from | |
rdb$indices i | |
left join rdb$index_segments s on i.rdb$index_name = s.rdb$index_name | |
left join rdb$relation_constraints rc on rc.rdb$index_name = i.rdb$index_name | |
where | |
rc.rdb$constraint_type = 'PRIMARY KEY' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [en] select all tables | |
-- [pt] selecionar todas as tabelas | |
select distinct | |
rdb$relation_name | |
from | |
rdb$relation_fields | |
where | |
rdb$system_flag = 0 | |
and | |
rdb$view_context is null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [en] select all tables and views | |
-- [pt] selecionar todas as tabelas e views | |
select distinct | |
rdb$relation_name | |
from | |
rdb$relation_fields | |
where | |
rdb$system_flag = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [en] select all views | |
-- [pt] selecionar todas as views | |
select distinct | |
rdb$view_name | |
from | |
rdb$view_relations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
rdb$type, | |
rdb$type_name | |
from | |
rdb$types | |
where | |
rdb$field_name = 'rdb$object_type' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment