[Dailydave] INFILTRATE Contests: BINNAVI

Halvar Flake HalVar at gmx.de
Fri Aug 28 17:44:54 EDT 2015


Hey all,

I haven't gotten around to finishing it yet, but I have begun writing
a few small documents that explain what is needed to write a disassembly
to the BinNavi database (e.g. that does what the IDA exporter currently
does).

There are 3 files planned:
 README_SQL        // The general format of the disassembly
 README_TYPES      // Peculiarities for those that want a type system
 README_OPERANDS   // How to write BinNavi's "operand trees"

At the moment, only a work-in-progress version of README_SQL exists.
Once the files are semi-ready, they will be placed on github.

In the meantime, and because Dave called this (awesome!) contest, here is
the work-in-progress version version of README_SQL, in the hope of helping
people get started.

===================================================
Writing Disassemblies into the Database for BinNavi
===================================================

At the moment, BinNavi depends on other disassemblers to provide the
disassembly and CFGs to display - the current codebase ships with a binary
blob IDA Pro plugin that exports IDA disassemblies into the database.

In an ideal world, BinNavi would be able to perform disassembly itself, or
at least have more connectivity to other tools that can generate such dis-
assemblies. This is not an ideal world yet.

This file is an attempt at documenting the process of writing a disassembly
into the Postgres database in the same way that the IDA exporter does it. 

=====================
How to read this file
=====================

The format of this file is a commented log of Postgresql statements with
explanations about what data is written how, and why. There is some legacy
cruft in the structure of the database, and some of our design choices were
dubious, but such is the nature of any large codebase written by kids in their
early-to-mid-20s. Most of this stuff is relatively straightforward, I hope
the complicated bits can be explained.

create schema "public"
set search_path to "public"
create table "modules" (
  "id" serial, 
  "name" text not null, 
  "architecture" varchar(32) not null, 
  "base_address" bigint not null, 
  "exporter" varchar(256) not null, 
  "version" int not null, 
  "md5" char(32) not null, 
  "sha1" char(40) not null, 
  "comment" text, 
  "import_time" timestamp not null default current_timestamp,
  primary key ("id"));
begin
lock table "modules" in access exclusive mode
select coalesce(max(id), 0) + 1 from modulesi  -- Get the ID for the new module
                                               -- to insert.
select count(*) from modules
select count(*) from modules where id = $1::int limit 1

insert into modules values(
  $1::int,           -- The new module ID, for example '3'.
  $2::text,          -- The name of the module, for example 'foobar.dll'.
  $3::varchar,       -- Description string for the CPU arch: 'x86-32'.
  $4::bigint,        -- Base address in virtual memory of the module.
  $5::varchar,       -- Name of the tool writing the module.
  $6::int,           -- Version of the tool. For some reason, '7' (?).
  $7::varchar,       -- MD5 of the input file.
  $8::varchar,       -- SHA1 of the input file.
  '',                -- Per-module comment string.
  now())             -- Current timestamp for the module.     
commit

begin
-- Clean all the tables for the new module with ID '3'.
-- TODO: It seems a number of tables (for the type system) were added later to
-- the exporting code, but they do not appear to be deleted in this step.

drop table if exists "ex_3_address_comments"
drop table if exists "ex_3_address_references"
drop table if exists "ex_3_expression_substitutions"
drop table if exists "ex_3_operands"
drop table if exists "ex_3_expression_tree_nodes"
drop table if exists "ex_3_expression_trees"
drop table if exists "ex_3_expression_nodes"
drop table if exists "ex_3_control_flow_graphs"
drop table if exists "ex_3_callgraph"
drop table if exists "ex_3_basic_block_instructions"
drop table if exists "ex_3_instructions"
drop table if exists "ex_3_basic_blocks"
drop table if exists "ex_3_functions"
drop table if exists "ex_3_type_renderers"
drop table if exists "ex_3_base_types"
drop table if exists "ex_3_types"
drop table if exists "ex_3_sections"
drop table if exists "ex_3_type_substitution_paths"

------------------------------------------------------------------------------
-- Re-create these tables for the module.
------------------------------------------------------------------------------
-- The table for functions.
create table "ex_3_functions" (
  "address" bigint not null,   -- Virtual address of the function
  "name" text not null,        -- 
  "demangled_name" text null default null,
  "has_real_name" boolean not null,
  "type" int not null default 0 check( "type" in ( 0, 1, 2, 3, 4 )),
  "module_name" text null default null,
  "stack_frame" int null default null,
  "prototype" int null default null)

create table "ex_3_basic_blocks" (
  "id" int not null,
  "parent_function" bigint not null,
  "address" bigint not null)

create table "ex_3_instructions" (
  "address" bigint not null,
  "mnemonic" varchar( 32 ) not null,
  "data" bytea not null)

create table "ex_3_basic_block_instructions" (
  "basic_block_id" int not null,
  "instruction" bigint not null,
  "sequence" int not null)

create table "ex_3_callgraph" (
  "id" serial,
  "source" bigint not null,
  "source_basic_block_id" int not null,
  "source_address" bigint not null,
  "destination" bigint not null)

create table "ex_3_control_flow_graphs" (
  "id" serial,
  "parent_function" bigint not null,
  "source" int not null,
  "destination" int not null,
  "type" int not null default 0 check( "type" in ( 0, 1, 2, 3 )))

create table "ex_3_expression_trees" (
  "id" serial)

create table "ex_3_expression_nodes" (
  "id" serial,
  "type" int not null default 0 check( "type" >= 0 and "type" <= 7 ),
  "symbol" varchar( 256 ),
  "immediate" bigint,
  "position" int,
  "parent_id" int check( "id" > "parent_id" ))

create table "ex_3_expression_tree_nodes" (
  "expression_tree_id" int not null,
  "expression_node_id" int not null)

create table "ex_3_operands" (
  "address" bigint not null,
  "expression_tree_id" int not null,
  "position" int not null)

create table "ex_3_expression_substitutions" (
  "id" serial,
  "address" bigint not null,
  "position" int not null,
  "expression_node_id" int not null,
  "replacement" text not null)

create table "ex_3_address_references" (
  "address" bigint not null,
  "position" int null,
  "expression_node_id" int null,
  "destination" bigint not null,
  "type" int not null default 0 check( "type" >= 0 and "type" <= 8 ))

create table "ex_3_address_comments" (
  "address" bigint not null,
  "comment" text not null)

drop type if exists "ex_3_type_category"
create type "ex_3_type_category" as enum ('atomic', 'pointer', 'array','struct', 'union', 'function_pointer')

create table "ex_3_base_types" (
  "id" integer not null,
  "name" text not null,
  "size" integer not null,
  "pointer" integer,
  "signed" bool,
  "category" "ex_3_type_category" not null)

create table "ex_3_types" (
  "id" serial not null,
  "name" text not null,
  "base_type" integer not null,
  "parent_id" integer,
  "offset" integer,
  "argument" integer,
  "number_of_elements" integer)

drop type if exists "ex_3_type_renderers_renderer_type"
create type "ex_3_type_renderers_renderer_type" as enum ('integer','floating point', 'boolean', 'ascii', 'utf8', 'utf16')

create table "ex_3_type_renderers" ("type_id" int not null,"renderer" "ex_3_type_renderers_renderer_type" not null)
drop type if exists "ex_3_section_permission_type"
create type "ex_3_section_permission_type" as enum ('READ', 'WRITE','EXECUTE', 'READ_WRITE', 'READ_EXECUTE', 'WRITE_EXECUTE','READ_WRITE_EXECUTE')
create table "ex_3_sections" ("id" serial not null,"name" text not null,"start_address" bigint not null,"end_address" bigint not null,"permission" "ex_3_section_permission_type" not null,"data" bytea not null)
create table "ex_3_expression_types" ("address" bigint not null,"position" integer not null,"expression_id" integer not null,"type" integer not null,"path" integer[] not null,"offset" integer)
create table "ex_3_expression_type_instances" ("address" bigint not null,"position" integer not null,"expression_node_id" integer not null,"type_instance_id" integer not null)
create table "ex_3_type_instances" ("id" integer not null,"name" text not null,"section_offset" bigint not null,"type_id" integer not null,"section_id" integer not null)
create table "ex_3_type_substitution_paths" ("id" integer not null,"child_id" integer,"type_id" integer not null)

------------------------------------------------------------------------------
-- Done creating the tables. Now Re-create these tables for the module.
------------------------------------------------------------------------------

------------------------------------------------------------------------------
-- Insert the raw data for the memory sections in this module. Repeat this for
-- each memory section
------------------------------------------------------------------------------

insert into "ex_3_sections" (
  "id", 
  "name", 
  "start_address", 
  "end_address",
  "permission", 
  "data") 
  values ($1::integer, $2::text, $3::bigint, $4::bigint, 
  $5::ex_3_section_permission_type, $6::bytea)

------------------------------------------------------------------------------
-- Insert the type system into the database. This should be ignored initially,
-- as BinNavi will work happily without any type system. Please refer to the
-- yet-to-be written README_TYPES for a description of the tables for the type
-- system. Simply make sure these tables exist, but leave them empty, for an
-- initial go at exporting.
------------------------------------------------------------------------------

-- Insert basic (root) types.
insert into "ex_3_base_types" (
  "id", 	 
  "name", 
  "size", 
  "pointer", 
  "signed", 
  "category") values (...)

insert into "ex_3_types" (
  "id", 
  "name", 
  "base_type", 
  "parent_id", 
  "offset", 
  "argument", 
  "number_of_elements") values (...)

insert into "ex_3_expression_types" (
  "address", 
  "position", 
  "expression_id", 
  "type", 
  "path", 
  "offset") values (268720502,0,15,789,'{ 2998 }',128),(...)

insert into "ex_3_type_instances" (
  "id", 
  "section_offset", 
  "type_id", 
  "section_id", 
  "name") values (422,0,6,3,'unk_1005F000'),(...)

insert into "ex_3_expression_type_instances" (
  "address", 
  "position", 
  "expression_node_id", 
  "type_instance_id") values (268439554,0,10247,1468),(...)

------------------------------------------------------------------------------
-- Insert per-instruction comments into the database. This is very straight-
-- forward.
------------------------------------------------------------------------------

insert into "ex_3_address_comments" values (268439583,'unsigned int'),(...)

------------------------------------------------------------------------------
-- Operands are added by inserting the address of the instruction, the ID of 
-- the "expression tree" describing the operand, and the position in the ins-
-- struction where the operand belongs. Please see the yet-to-be-written
-- README_OPERANDS for details about the operand tree structure.
------------------------------------------------------------------------------

insert into "ex_3_operands" values (268439552,37,0),(268439554,10766,0),(...)

------------------------------------------------------------------------------
-- Instructions are identified by their address, and are simple otherwise. 
------------------------------------------------------------------------------

insert into "ex_3_instructions" values (268439552,'push',decode('6AFF','hex'))

------------------------------------------------------------------------------
-- Insert functions. 
------------------------------------------------------------------------------

insert into "ex_3_functions" values 
  (268439552,         -- address of the function.
  'sub_10001000',     -- non-demangled name of the function.
  null,               -- demangled name, if available.
  false,              -- set this true if the name is sensible.
  0,                  -- type of the function.
                      -- NORMAL = 0;   // Regular function w/ full disassembly.
                      -- LIBRARY = 1;  // Statically linked
                      -- IMPORTED = 2; // Not real code, just a DWORD ptr.
                      -- THUNK = 3     // A thunk function, forwarding via an 
                      --               // uncondional jump.
                      -- INVALID = 4   // A function contianing invalid code or
                      --               // otherwise suspect stuff
  'Onix32.dll',       -- The name of the module this function belongs to.
  26,                 -- An ID referencing the type describing the stack frame.
                      -- Can be null if you do not have a type system.
  1230),              -- An ID referencing the type describing the function.
                      -- Can also be null if you do not have a type system.
  (...)         

insert into "ex_3_basic_blocks" values 
  (1,                 -- ID of the basic block.
  268439552,          -- Address of the function this basic block belongs to.
  268439552),         -- Address of the basic block.
  (...)  

------------------------------------------------------------------------------
-- Basic blocks can contain arbitrary sequences of instructions - even non-
-- consecutive. This is useful for things such as purging garbage instructions
-- from obfuscated code, or reordering instructions for easier reading.
------------------------------------------------------------------------------

insert into "ex_3_basic_block_instructions" values 
  (1,                 -- ID of the basic block an instruction belongs to.
  268439552,          -- Address of the instruction that belongs to the block.
  0),                 -- Sequence index of the instruction, starting at 0.
  (...)

------------------------------------------------------------------------------
-- CFGs for a given function are constructed by simply listing edges between
-- the basic blocks of that function, along with an edge type.
------------------------------------------------------------------------------

insert into "ex_3_control_flow_graphs" 
  ("parent_function", "source", "destination", "type") values 
  (268439552,         -- Address of the parent function.
  1,                  -- Basic block ID of the source block.
  2,                  -- Basic block ID of the destination block.
  1),                 -- Type of the edge. Valid types are:
                      -- CONDITION_TRUE = 0
                      -- CONDITION_FALSE = 1
                      -- UNCONDITIONAL = 3
                      -- SWITCH = 4
  (...)

------------------------------------------------------------------------------
-- Writing the callgraph writes edges between the functions in the executable.
------------------------------------------------------------------------------

insert into "ex_3_callgraph" 
  ("source", "source_basic_block_id", "source_address", "destination") values 
  (268439552,         -- Address of the function in which the edge originates.
  1,                  -- ID of the basic block in which the edge originates.
  268439598,          -- Address of the originating instruction.
  268720341),         -- Address of the target of this edge.
  (...)

------------------------------------------------------------------------------
-- Now comes the ugly part of writing an executable - writing operands for the
-- instructions. This is much more involved than one would like, but given
-- that the only "common" data structure that will accomodate the different 
-- operand structures possible on various CPUs are essentially arbitrary trees
-- of expressions, the complexity is not entirely avoidable. 
------------------------------------------------------------------------------

insert into "ex_3_expression_nodes" values 
  (14282,
  2,                  -- Currently valid types of nodes:
                      -- SYMBOL = 1;           // String to be displayed.
                      -- IMMEDIATE_INT = 2;
                      -- IMMEDIATE_FLOAT = 3;
                      -- OPERATOR = 4;         // '+', '*' etc.
                      -- REGISTER = 5;
                      -- SIZE_PREFIX = 6;      // 'B4, 'B8', etc.
                      -- DEREFERENCE = 7;      // Memory dereference.
  null,               -- Symbol string if applicable.
  268687200,          -- If this is a constant/immediate, the value.
  0,                  -- The position within the operand. This means that
                      -- in a string like [esp+eax+6450h+var_63D0], the  
  1),                 -- ID of the parent node in the tree.
  (...)

insert into "ex_3_expression_trees" values (15063),(15062),(15060),(15058),(15054),(15051),(15050),(15048),(15047),(15045),(15044),(15042),(15040),(15039),(15034),(15033),(15030),(15028),(15027),(15026),(15025),(15023),(15016),(15011),(15010),(15007),(15006),(15004),(15002),(15001),(15000),(14999),(14998),(14996),(14995),(14992),(14990),(14988),(149

insert into "ex_3_expression_tree_nodes" values (15063,1),(15063,14285),(15062,1),(15062,14284),(15060,1),(15060,14282),(15058,1),(15058,14280),(15054,1),(15054,14276),(15051,1),(15051,14273),(15050,1),(15050,14272),(15048,1),(15048,14270),(15047,1),(15047,14269),(15045,1),(15045,14267),(15044,1),(15044,14266),(15042,1),(15042,14264),(15040,1),(1504


create table "ex_3_expression_trees" (
  "id" serial)

create table "ex_3_expression_nodes" (
  "id" serial,
  "type" int not null default 0 check( "type" >= 0 and "type" <= 7 ),
  "symbol" varchar( 256 ),
  "immediate" bigint,
  "position" int,
  "parent_id" int check( "id" > "parent_id" ))

create table "ex_3_expression_tree_nodes" (
  "expression_tree_id" int not null,
  "expression_node_id" int not null)

create table "ex_3_operands" (
  "address" bigint not null,
  "expression_tree_id" int not null,
  "position" int not null)



-- Create indices on the tables now that they contain data.

create unique index "ex_3_functions_address_idx" on "ex_3_functions"( "address" )
create unique index "ex_3_basic_blocks_id_idx" on "ex_3_basic_blocks"( "id" )
create index "ex_3_basic_blocks_address_idx" on "ex_3_basic_blocks"( "address" )
create unique index "ex_3_instructions_address_idx" on "ex_3_instructions"( "address" )
create unique index "ex_3_expression_trees_id_idx" on "ex_3_expression_trees"( "id" )
create unique index "ex_3_expression_nodes_id_idx" on "ex_3_expression_nodes"( "id" )

insert into "ex_3_expression_substitutions" ("address", "position", "expression_node_id", "replacement") values (268720405,1,737,'esp+arg_4'),(268724748,1,737,'esp+var_20'),(268724778,1,737,'esp+var_20'),(268725269,0,3008,'esp+var_8'),(268725272,1,3008,'esp+var_8'),(268725329,0,3008,'esp+var_8'),(268725332,1,3008,'esp+var_8'),(268725392,0,3008,'esp+
SELECT 1
SELECT 1
insert into "ex_3_address_references" values (268439554,0,10247,268779723,7),(268439598,0,4085,268720341,4),(268439620,0,1,268439622,1),(268439620,0,10249,268439641,0),(268439630,0,4152,268612576,4),(268439639,0,10275,268439645,2),(268439659,0,1,268439661,1),(268439659,0,10250,268439690,0),(268439693,0,1,268439695,1),(268439693,0,10251,268439724,0),
delete from ex_3_instructions as instructions using ex_3_basic_block_instructions as basic_block_instructions where basic_block_instructions.instruction = instructions.address and basic_block_id is null;
delete from ex_3_basic_block_instructions where basic_block_id is null;
delete from ex_3_address_references where address in ( select address from ex_3_address_references except select address from ex_3_instructions)
SELECT 1
delete from ex_3_address_comments where address in ( select address from ex_3_address_comments except select address from ex_3_instructions)
delete from ex_3_expression_substitutions where address in ( select address from ex_3_expression_substitutions except select address from ex_3_instructions)
delete from ex_3_operands where address in ( select address from ex_3_operands except select address from ex_3_instructions)
delete from ex_3_expression_type_instances where address in ( select address from ex_3_expression_type_instances except select address from ex_3_operands)
alter table "ex_3_functions" add primary key( "address" )
alter table "ex_3_basic_blocks" add primary key( "id" )
alter table "ex_3_basic_blocks" add constraint "ex_3_basic_blocks_parent_function_fkey" foreign key ( "parent_function" ) references "ex_3_functions"( "address" ) on delete cascade on update cascade
alter table "ex_3_instructions" add primary key( "address" )
alter table "ex_3_basic_block_instructions" add constraint "ex_3_basic_block_instructions_bb_fkey" foreign key ( "basic_block_id" ) references "ex_3_basic_blocks"( "id" ) on delete cascade on update cascade
SELECT 1
alter table "ex_3_basic_block_instructions" add constraint "ex_3_basic_block_instructions_ins_fkey" foreign key ( "instruction" ) references "ex_3_instructions"( "address" ) on delete cascade on update cascade
alter table "ex_3_callgraph" add primary key( "id" )
alter table "ex_3_callgraph" add constraint "ex_3_callgraph_source_fkey" foreign key ( "source" ) references "ex_3_functions"( "address" ) on delete cascade on update cascade
alter table "ex_3_callgraph" add constraint "ex_3_callgraph_destination_fkey" foreign key ( "destination" ) references "ex_3_functions"( "address" ) on delete cascade on update cascade
alter table "ex_3_callgraph" add constraint "ex_3_callgraph_source_basic_block_id_fkey" foreign key ( "source_basic_block_id" ) references "ex_3_basic_blocks"( "id" ) on delete cascade on update cascade
alter table "ex_3_callgraph" add constraint "ex_3_callgraph_source_address_fkey" foreign key ( "source_address" ) references "ex_3_instructions"( "address" ) on delete cascade on update cascade
alter table "ex_3_control_flow_graphs" add primary key( "id" )
alter table "ex_3_control_flow_graphs" add constraint "ex_3_control_flow_graphs_parent_function_fkey" foreign key ( "parent_function" ) references "ex_3_functions"( "address" ) on delete cascade on update cascade
alter table "ex_3_control_flow_graphs" add constraint "ex_3_control_flow_graphs_source_fkey" foreign key ( "source" ) references "ex_3_basic_blocks"( "id" ) on delete cascade on update cascade
alter table "ex_3_control_flow_graphs" add constraint "ex_3_control_flow_graphs_destination_fkey" foreign key ( "destination" ) references "ex_3_basic_blocks"( "id" ) on delete cascade on update cascade
alter table "ex_3_expression_trees" add primary key( "id" )
alter table "ex_3_expression_nodes" add primary key( "id" )
alter table "ex_3_expression_nodes" add constraint "ex_3_expression_nodes_parent_id_fkey" foreign key ( "parent_id" ) references "ex_3_expression_nodes"( "id" ) on delete cascade on update cascade
SELECT 1
alter table "ex_3_expression_tree_nodes" add constraint "ex_3_expression_tree_nodes_expression_tree_id_fkey" foreign key ( "expression_tree_id" ) references "ex_3_expression_trees"( "id" ) on delete cascade on update cascade
alter table "ex_3_expression_tree_nodes" add constraint "ex_3_expression_tree_nodes_expression_node_id_fkey" foreign key ( "expression_node_id" ) references "ex_3_expression_nodes"( "id" ) on delete cascade on update cascade
alter table "ex_3_operands" add primary key ( "address", "position" )
alter table "ex_3_operands" add constraint "ex_3_operands_expression_tree_id_fkey" foreign key ( "expression_tree_id" ) references "ex_3_expression_trees"( "id" ) on delete cascade on update cascade
alter table "ex_3_operands" add constraint "ex_3_operands_address_fkey" foreign key ( "address" ) references "ex_3_instructions"( "address" ) on delete cascade on update cascade
SELECT 1
alter table "ex_3_expression_substitutions" add constraint "ex_3_expression_substitutions_address_position_fkey" foreign key ( "address", "position" ) references "ex_3_operands"( "address", "position" ) on delete cascade on update cascade
alter table "ex_3_expression_substitutions" add constraint "ex_3_expression_substitutions_expression_node_id_fkey" foreign key ( "expression_node_id" ) references "ex_3_expression_nodes"( "id" ) on delete cascade on update cascade
alter table "ex_3_address_references" add constraint "ex_3_address_references_address_position" foreign key ( "address", "position" ) references "ex_3_operands"( "address", "position" ) on delete cascade on update cascade
alter table "ex_3_address_references" add constraint "ex_3_address_references_expression_node_id_fkey" foreign key ( "expression_node_id" ) references "ex_3_expression_nodes"( "id" ) on delete cascade on update cascade
alter table "ex_3_base_types" add primary key ( "id" )
alter table "ex_3_base_types" add constraint "ex_3_base_types_pointer_fkey" foreign key ( "pointer" ) references "ex_3_base_types"( "id" ) on delete cascade on update cascade deferrable initially deferred
alter table "ex_3_types" add primary key ( "id")
alter table "ex_3_types" add constraint "ex_3_types_parent_id_fkey" foreign key ( "parent_id" ) references "ex_3_base_types" ( "id" ) on delete cascade on update cascade deferrable initially deferred
alter table "ex_3_types" add constraint "ex_3_types_base_type_fkey" foreign key ( "base_type" ) references "ex_3_base_types" ( "id" ) on delete cascade on update cascade
alter table "ex_3_expression_types" add primary key ( "address", "position", "expression_id" )
alter table "ex_3_expression_types" add constraint "ex_3_expression_type_type_fkey" foreign key ( "type" ) references "ex_3_base_types" ( "id" ) on update no action on delete cascade deferrable initially deferred
alter table "ex_3_sections" add primary key ( "id" )
alter table "ex_3_type_instances" add primary key ( "id" )
alter table "ex_3_type_instances" add constraint ex_3_type_instances_type_id_fkey foreign key ( "type_id" ) references ex_3_base_types ( "id" ) match simple on update cascade on delete cascade
alter table "ex_3_type_instances" add constraint ex_3_type_instances_section_id_fkey foreign key ( "section_id" ) references ex_3_sections ( "id" ) match simple on update cascade on delete cascade
SELECT 1
alter table "ex_3_expression_type_instances" add primary key ( "address", "position", "expression_node_id" )
alter table "ex_3_expression_type_instances" add constraint "ex_3_expression_type_instances_type_instance_id_fkey" foreign key ( "type_instance_id" ) references ex_3_type_instances ( "id" ) match simple on update cascade on delete cascade
alter table "ex_3_expression_type_instances" add constraint "ex_3_expression_type_instances_address_position_fkey" foreign key ( "address", "position" ) references ex_3_operands ( "address", "position" ) match simple on update cascade on delete cascade
alter table "ex_3_expression_type_instances" add constraint "ex_3_expression_type_instances_expression_node_id_fkey" foreign key ( "expression_node_id" ) references ex_3_expression_nodes ( "id" ) match simple on update cascade on delete cascade
deallocate all
commit
vacuum analyze "ex_3_operands"
SELECT 1
vacuum analyze "ex_3_functions"
vacuum analyze "ex_3_basic_blocks"
vacuum analyze "ex_3_instructions"
SELECT 1
vacuum analyze "ex_3_basic_block_instructions"
vacuum analyze "ex_3_callgraph"
vacuum analyze "ex_3_control_flow_graphs"
vacuum analyze "ex_3_expression_trees"
vacuum analyze "ex_3_expression_nodes"
SELECT 1
vacuum analyze "ex_3_expression_tree_nodes"
vacuum analyze "ex_3_expression_substitutions"
vacuum analyze "ex_3_address_references"
vacuum analyze "ex_3_address_comments"
vacuum analyze "ex_3_type_renderers"
vacuum analyze "ex_3_base_types"
vacuum analyze "ex_3_types"
SELECT 1
vacuum analyze "ex_3_expression_types"
vacuum analyze "ex_3_sections"
SET extra_float_digits = 3
SELECT relname FROM pg_class WHERE relname = 'modules'
SELECT 1
SELECT id, name FROM modules ORDER BY id
SELECT 1
SELECT 1
SELECT count(*) AS fcount  FROM ex_1_functions  WHERE address <> 0  OR type <> 3
SELECT 1
SELECT count(*) AS fcount  FROM ex_2_functions  WHERE address <> 0  OR type <> 3
SELECT 1
select table_name from information_schema.tables  where table_catalog = 'foss_navi_test5' 
SELECT 1
SELECT count(*) AS fcount  FROM ex_3_functions  WHERE address <> 0  OR type <> 3
select * from create_module($1,$2)  as result
 '', $2 = '3'
SELECT 1
SELECT id, bn_modules.name, md5, sha1,  description, import_time, modification_date, image_base, file_base, stared,  initialization_state  FROM bn_modules WHERE id = 10 ORDER by id




More information about the Dailydave mailing list