Pastey EDS: create_table error when init_records < MAX_INDEX

# HG changeset patch
# User Guillermo Bonvehi 
# Date 1391759568 10800
# Node ID a34be11ef13eb7cd7fdeb86946319d0b1c53c9ae
# Parent  2c379fb63e7481d4e7aa1330b5d4789af612a163
EDS: create_table error when init_records < MAX_INDEX

diff -r 2c379fb63e74 -r a34be11ef13e include/std/eds.e
--- a/include/std/eds.e Wed Jan 29 11:00:14 2014 -0500
+++ b/include/std/eds.e Fri Feb 07 04:52:48 2014 -0300
@@ -1613,6 +1613,9 @@
                init_records = 1
        end if
        init_index = math:min({init_records, MAX_INDEX})
+       if init_index < 2 then
+               init_index = 2
+       end if

        -- increment number of tables
        io:seek(current_db, TABLE_HEADERS)
diff -r 2c379fb63e74 -r a34be11ef13e tests/t_database.e
--- a/tests/t_database.e        Wed Jan 29 11:00:14 2014 -0500
+++ b/tests/t_database.e        Fri Feb 07 04:52:48 2014 -0300
@@ -372,6 +372,20 @@
 end procedure
 test_dump()

+procedure test_create_table_init_0()
+       sequence the_db = "create_table_init_0.edb"
+       db_fatal_id = routine_id( "db_fatal_error" )
+       db_close()
+       if file_exists( the_db ) then
+               delete_file( the_db )
+       end if
+       test_equal( "create " & the_db, DB_OK, db_create( the_db ) )
+       test_equal( "create " & the_db & " table", DB_OK, db_create_table( "table", 0 ) )
+       db_insert( "dummy", "data" )
+       db_close()
+       delete_file( the_db )
+end procedure
+test_create_table_init_0()


 test_report()