提交 e9b4498c authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 8bd9aeaa
#Sat Dec 01 09:41:20 CET 2007
#Mon Dec 10 07:25:40 CET 2007
javac=javac
benchmark.drivers.dir=C\:/data/java
path.servlet.jar=C\:/data/classpath/servlet-api.jar
......
......@@ -14,6 +14,7 @@ import org.h2.constraint.ConstraintCheck;
import org.h2.constraint.ConstraintReferential;
import org.h2.constraint.ConstraintUnique;
import org.h2.engine.Database;
import org.h2.engine.DbObject;
import org.h2.engine.Right;
import org.h2.engine.Session;
import org.h2.expression.Expression;
......@@ -52,9 +53,9 @@ public class AlterTableAddConstraint extends SchemaCommand {
super(session, schema);
}
private String generateConstraintName(int id) throws SQLException {
private String generateConstraintName(DbObject obj, int id) throws SQLException {
if (constraintName == null) {
constraintName = getSchema().getUniqueConstraintName();
constraintName = getSchema().getUniqueConstraintName(obj);
}
return constraintName;
}
......@@ -72,7 +73,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
switch (type) {
case CHECK: {
int id = getObjectId(true, true);
String name = generateConstraintName(id);
String name = generateConstraintName(table, id);
ConstraintCheck check = new ConstraintCheck(getSchema(), id, name, table);
TableFilter filter = new TableFilter(session, table, null, false, null);
checkExpression.mapColumns(filter, 0);
......@@ -99,7 +100,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
}
int id = getObjectId(true, true);
String name = generateConstraintName(id);
String name = generateConstraintName(table, id);
ConstraintUnique unique = new ConstraintUnique(getSchema(), id, name, table);
unique.setColumns(columns);
unique.setIndex(index, isOwner);
......@@ -146,7 +147,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
}
int id = getObjectId(true, true);
String name = generateConstraintName(id);
String name = generateConstraintName(table, id);
ConstraintReferential ref = new ConstraintReferential(getSchema(), id, name, table);
ref.setColumns(columns);
ref.setIndex(index, isOwner);
......@@ -186,7 +187,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
indexType.setBelongsToConstraint(true);
String prefix = constraintName == null ? "CONSTRAINT" : constraintName;
String indexName = getSchema().getUniqueIndexName(prefix + "_INDEX_");
String indexName = getSchema().getUniqueIndexName(t, prefix + "_INDEX_");
IndexColumn[] idxCols = IndexColumn.wrap(cols);
return t.addIndex(session, indexName, indexId, idxCols, indexType, Index.EMPTY_HEAD, null);
}
......
......@@ -70,7 +70,7 @@ public class CreateIndex extends SchemaCommand {
}
int id = getObjectId(true, false);
if (indexName == null) {
indexName = getSchema().getUniqueIndexName("INDEX_");
indexName = getSchema().getUniqueIndexName(table, "INDEX_");
}
if (getSchema().findIndex(indexName) != null) {
if (ifNotExists) {
......
......@@ -56,7 +56,8 @@ import org.h2.constant.SysProperties;
* - Make sure the build files are removed
* - ant zip
* - Windows installer (nsis)
* - Test
* - Test Console
* - Test all languages
* - Test the windows service
* - Scan for viruses
* - ant mavenDeployCentral
......
......@@ -33,7 +33,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
// final static int MAX_PAGE_SIZE = 256;
private Storage storage;
private BtreePage root;
private BtreePage rootPage;
private TableData tableData;
private BtreeHead head;
private boolean needRebuild;
......@@ -57,7 +57,8 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
head = (BtreeHead) rec;
}
if (head != null && head.getConsistent()) {
setRoot((BtreePage) storage.getRecord(session, head.getRootPosition()));
int testing;
// setRoot((BtreePage) storage.getRecord(session, head.getRootPosition()));
needRebuild = false;
rowCount = table.getRowCount(session);
} else {
......@@ -67,12 +68,20 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
}
}
private void setRoot(BtreePage newRoot) {
if (root != null) {
root.setRoot(false);
private BtreePage getRoot(Session session) throws SQLException {
if (rootPage == null) {
setRoot((BtreePage) storage.getRecord(session, head.getRootPosition()));
}
return rootPage;
}
private BtreePage setRoot(BtreePage newRoot) {
if (rootPage != null) {
rootPage.setRoot(false);
}
newRoot.setRoot(true);
root = newRoot;
rootPage = newRoot;
return rootPage;
}
public int getHeadPos() {
......@@ -151,12 +160,13 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
Value v = r.getValue(idx);
row.setValue(idx, v);
}
BtreePage root = getRoot(session);
int splitPoint = root.add(row, session);
if (splitPoint != 0) {
SearchRow pivot = root.getData(splitPoint);
BtreePage page1 = root;
BtreePage page2 = root.split(session, splitPoint);
setRoot(new BtreeNode(this, page1, pivot, page2));
root = setRoot(new BtreeNode(this, page1, pivot, page2));
addPage(session, root);
deletePage(session, head);
head.setRootPosition(root.getPos());
......@@ -171,6 +181,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
// TODO performance: maybe improve truncate performance in this case
truncate(session);
} else {
BtreePage root = getRoot(session);
root.remove(session, row, 0);
rowCount--;
}
......@@ -180,6 +191,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
if (SysProperties.CHECK && storage == null) {
throw Message.getSQLException(ErrorCode.OBJECT_CLOSED);
}
BtreePage root = getRoot(session);
if (first == null) {
BtreeCursor cursor = new BtreeCursor(session, this, last);
root.first(cursor);
......@@ -257,7 +269,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
storage.truncate(session);
head = new BtreeHead();
addPage(session, head);
setRoot(new BtreeLeaf(this, new ObjectArray()));
BtreePage root = setRoot(new BtreeLeaf(this, new ObjectArray()));
addPage(session, root);
deletePage(session, head);
head.setRootPosition(root.getPos());
......@@ -301,7 +313,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
}
return null;
} else {
return root.getLast(session);
return getRoot(session).getLast(session);
}
}
......
......@@ -839,7 +839,8 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* Sets the value of a parameter as an input stream.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value * @throws SQLException if this object is closed
* @param x the value
* @throws SQLException if this object is closed
*/
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
setBinaryStream(parameterIndex, x, -1);
......
......@@ -24,6 +24,14 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
//#ifdef JDK16
/*
import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLXML;
*/
//#endif
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
......@@ -2668,7 +2676,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* Detects if the row was updated (by somebody else or the caller).
*
* @return false because this driver does detect this
* @return false because this driver does not detect this
*/
public boolean rowUpdated() throws SQLException {
try {
......@@ -2682,7 +2690,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* Detects if the row was inserted.
*
* @return false because this driver does detect this
* @return false because this driver does not detect this
*/
public boolean rowInserted() throws SQLException {
try {
......@@ -2696,7 +2704,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* Detects if the row was deleted (by somebody else or the caller).
*
* @return false because this driver does detect this
* @return false because this driver does not detect this
*/
public boolean rowDeleted() throws SQLException {
try {
......@@ -2928,10 +2936,6 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
return super.getTraceId();
}
JdbcConnection getConnection() {
return conn;
}
private boolean nextRow() throws SQLException {
boolean next = result.next();
if (!next && !scrollable) {
......
......@@ -6,6 +6,7 @@ package org.h2.schema;
import java.sql.SQLException;
import java.util.HashMap;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.constraint.Constraint;
......@@ -185,7 +186,15 @@ public class Schema extends DbObjectBase {
return (Constant) constants.get(constantName);
}
private String getUniqueName(HashMap map, String prefix) {
private String getUniqueName(DbObject obj, HashMap map, String prefix) {
String hash = Integer.toHexString(obj.getName().hashCode()).toUpperCase();
for (int i = 1; i < hash.length(); i++) {
String name = prefix + hash.substring(0, i);
if (map.get(name) == null) {
return name;
}
}
prefix = prefix + hash + "_";
for (int i = 0;; i++) {
String name = prefix + i;
if (map.get(name) == null) {
......@@ -194,12 +203,12 @@ public class Schema extends DbObjectBase {
}
}
public String getUniqueConstraintName() {
return getUniqueName(constraints, "CONSTRAINT_");
public String getUniqueConstraintName(DbObject obj) {
return getUniqueName(obj, constraints, "CONSTRAINT_");
}
public String getUniqueIndexName(String prefix) {
return getUniqueName(indexes, prefix);
public String getUniqueIndexName(DbObject obj, String prefix) {
return getUniqueName(obj, indexes, prefix);
}
public Table getTableOrView(Session session, String name) throws SQLException {
......
......@@ -70,7 +70,7 @@ public class WebServer implements Service {
"Generic OneDollarDB|in.co.daffodil.db.jdbc.DaffodilDBDriver|jdbc:daffodilDB_embedded:school;path=C:/temp;create=true|sa",
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://<host>/<db>|" ,
"Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc:oracle:thin:@<host>:1521:<instance>|scott" ,
"Generic MS SQL Server|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc:Microsoft:sqlserver://localhost:1433;DatabaseName=sqlexpress|sa",
"Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sqlexpress|sa",
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa",
"Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<db>|" ,
"Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://<host>:<port>/<db>|" ,
......
......@@ -1429,7 +1429,8 @@ class WebThread extends Thread implements DatabaseEventListener {
stat.close();
}
return buff.toString();
} catch (Exception e) {
} catch (Throwable e) {
// throwable: including OutOfMemoryError and so on
return getStackTrace(id, e);
} finally {
session.executingStatement = null;
......
<!-- can not use doctype -->
<!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
<!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html>
......@@ -13,13 +13,14 @@ Initial Developer: H2 Group
var agent=navigator.userAgent.toLowerCase();
var is_opera = agent.indexOf("opera") >= 0;
var autoComplete = 1;
var autoComplete = 1; // 0: off, 1: normal, 2: full
var selectedRow = -1;
var lastList = '';
var lastQuery = null;
var columnsByTable = new Object();
var tableAliases = new Object();
var showAutoCompleteWait = 0;
var autoCompleteManual = false;
var req;
function refreshTables() {
......@@ -71,7 +72,7 @@ function splitSQL(s) {
function help() {
var input = document.h2query.sql;
setSelection(input);
var pos = input.selectionStart;
var pos = input.selectionStart;
if(pos > 0) {
var s = input.value.substring(0, pos).toUpperCase();
var e = pos-1;
......@@ -108,7 +109,7 @@ function setSelection(element) {
} catch (e) {
element.selectionEnd = element.selectionStart = 0;
}
}
}
}
function set(field, combo) {
......@@ -172,13 +173,6 @@ function insertText(s, isTable) {
field.focus();
}
function keyUp() {
if(autoComplete != 0) {
showAutoComplete();
}
return true;
}
function showAutoComplete() {
if(showAutoCompleteWait==0) {
showAutoCompleteWait=5;
......@@ -206,24 +200,32 @@ function keyDown(event) {
return false;
}
if (key == 13 && event.ctrlKey) {
// ctrl + return
document.h2query.submit();
return false;
} else if(key == 32 && event.ctrlKey) {
showAutoComplete();
// ctrl + space
autoCompleteManual = true;
lastQuery = null;
lastList = '';
showAutoCompleteNow();
return false;
} else if(key == 190 && autoComplete==0) {
// dot
help();
return true;
}
var table = getAutoCompleteTable();
if(table.rows.length > 0) {
if(key == 27) {
// escape
while(table.rows.length > 0) {
table.deleteRow(0);
}
showOutput('');
return false;
} else if((key == 13 && !event.shiftKey) || (key==9 && !event.shiftKey)) {
// enter or tab
if(table.rows.length > selectedRow) {
var row = table.rows[selectedRow];
if(row.cells.length>1) {
......@@ -231,31 +233,44 @@ function keyDown(event) {
}
if(autoComplete == 0) {
setAutoComplete(0);
}
}
return false;
}
} else if(key == 38 && !event.shiftKey) {
if(table.rows.length > selectedRow) {
// up
if(table.rows.length > selectedRow) {
selectedRow = selectedRow <= 0 ? table.rows.length-1 : selectedRow-1;
highlightRow(selectedRow);
}
return false;
return false;
} else if(key == 40 && !event.shiftKey) {
if(table.rows.length > selectedRow) {
// down
if(table.rows.length > selectedRow) {
selectedRow = selectedRow >= table.rows.length-1 ? 0 : selectedRow+1;
highlightRow(selectedRow);
}
return false;
return false;
}
}
return true;
// alert('key:' + key);
// bs:8 ret:13 lt:37 up:38 rt:39 dn:40 tab:9
// pgup:33 pgdn:34 home:36 end:35 del:46 shift:16
// ctrl,alt gr:17 alt:18 caps:20 5(num):12 ins:45
// pgup:33 pgdn:34 home:36 end:35 del:46 shift:16
// ctrl, alt gr:17 alt:18 caps:20 5(num):12 ins:45
// pause:19 f1..13:112..123 win-start:91 win-ctx:93 esc:27
}
function keyUp(event) {
if(autoComplete != 0) {
var key=event == null ? 0 : (event.keyCode? event.keyCode : event.charCode);
if(key != 37 && key != 38 && key != 39 && key != 40) {
// left, right, up, down: don't show autocomplete
showAutoComplete();
}
}
return true;
}
function setAutoComplete(value) {
autoComplete = value;
if(value != 1) {
......@@ -325,7 +340,7 @@ function showList(s) {
for(var i=0; list != null && i<list.length; i++) {
var kv = list[i].split('#');
var type = kv[0];
if(type > 0 && autoComplete != 2) {
if(type > 0 && autoComplete != 2 && !autoCompleteManual) {
continue;
}
var row = doc.createElement("tr");
......@@ -354,7 +369,7 @@ function showList(s) {
cell = doc.createElement("td");
cell.style.display='none';
text = doc.createTextNode(value);
cell.appendChild(text);
cell.appendChild(text);
row.appendChild(cell);
}
if(count > 0) {
......@@ -365,6 +380,7 @@ function showList(s) {
}
// scroll to the top left
top.h2result.scrollTo(0, 0);
autoCompleteManual = false;
}
function retrieveList(s) {
......@@ -436,7 +452,7 @@ function processAsyncResponse() {
<div style="display:none">
<iframe id="h2iframeTransport" src="" onload="showList(this.contentWindow.document.body.innerHTML);"></iframe>
</div>
<textarea id="sql" name="sql" cols="80" rows="5" onkeydown="return keyDown(event)" onkeyup="return keyUp()"
<textarea id="sql" name="sql" cols="80" rows="5" onkeydown="return keyDown(event)" onkeyup="return keyUp(event)"
onfocus="keyUp()" onchange="return keyUp()">${query}</textarea>
</form>
</body>
......
......@@ -35,8 +35,8 @@ import org.h2.util.MathUtils;
import org.h2.util.ObjectArray;
/**
* This class represents a file that is usually written to disk.
* The two main files are .data.db and .index.db.
* This class represents a file that is usually written to disk.
* The two main files are .data.db and .index.db.
* For each such file, a number of {@link Storage} objects exists.
* The disk file is responsible for caching; each object contains a {@link Cache} object.
* Changes in the file are logged in a {@link LogSystem} object.
......@@ -277,7 +277,7 @@ public class DiskFile implements CacheWriter {
}
}
}
public void init() throws SQLException {
synchronized (database) {
......@@ -351,6 +351,33 @@ public class DiskFile implements CacheWriter {
}
}
public void flushNew() throws SQLException {
int todoTest;
synchronized (database) {
database.checkPowerOff();
ObjectArray list = cache.getAllChanged();
CacheObject.sort(list);
int deletePos = deleted.nextSetBit(0);
int writeIndex = 0;
Record writeRecord = null;
while (true) {
if (writeRecord == null && writeIndex < list.size()) {
writeRecord = (Record) list.get(writeIndex++);
}
if (writeRecord != null && (deletePos < 0 || writeRecord.getPos() < deletePos)) {
writeBack(writeRecord);
writeRecord = null;
} else if (deletePos < fileBlockCount && deletePos >= 0) {
writeDirectDeleted(deletePos, 1);
deleted.clear(deletePos);
deletePos = deleted.nextSetBit(deletePos);
} else {
break;
}
}
}
}
public void close() throws SQLException {
synchronized (database) {
SQLException closeException = null;
......@@ -888,8 +915,6 @@ public class DiskFile implements CacheWriter {
if (last != null && last.data != null) {
writeRedoLog(last);
}
redoBuffer.clear();
redoBufferSize = 0;
}
......@@ -917,4 +942,8 @@ public class DiskFile implements CacheWriter {
}
}
public String toString() {
return getClass().getName() + ":" + fileName;
}
}
......@@ -36,7 +36,7 @@ public class FileSystemDisk extends FileSystem {
return INSTANCE;
}
private FileSystemDisk() {
protected FileSystemDisk() {
}
public long length(String fileName) {
......
......@@ -143,7 +143,7 @@ public class TableData extends Table implements RecordReader {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String indexComment) throws SQLException {
if (indexType.isPrimaryKey()) {
indexName = getSchema().getUniqueIndexName(Constants.PRIMARY_KEY_PREFIX);
indexName = getSchema().getUniqueIndexName(this, Constants.PRIMARY_KEY_PREFIX);
for (int i = 0; i < cols.length; i++) {
Column column = cols[i].column;
if (column.getNullable()) {
......
......@@ -152,24 +152,17 @@ java org.h2.test.TestAll timer
/*
History:
The performance has been improved for ResultSet methods with column name.
The method Trigger.init has been changed: the parameters 'before' and 'type', have been added to the init method.
The Ukrainian translation was not working in the last release. Fixed.
Creating many tables (many hundreds) was slow. Fixed.
Opening a database with many indexes (thousands) was slow. Fixed.
C:\temp\test\db
No more
@author
autocomplete only just after meaningful key (ctrl+space, space, bs, ...)
write more tests for the command line tools
C:\temp\test\db
Known Problems:
Web site:
link to history page, bug page
Add a link to the google code bug page
implement & test: checkpoint commits running transactions
test DbStarter
----
......@@ -203,8 +196,6 @@ shrink newsletter list (migrate to google groups)
don't create @~ of not translated
test performance and document fulltext search
clustered tables: test, document
extend tests that simulate power off
......@@ -297,6 +288,7 @@ Features of H2
if (args.length > 0) {
if ("crash".equals(args[0])) {
test.endless = true;
new TestCrashAPI().runTest(test);
} else if ("synth".equals(args[0])) {
new TestSynth().runTest(test);
......@@ -620,6 +612,7 @@ Features of H2
new TestMVCC().runTest(this);
// synthetic
new TestCrashAPI().runTest(this);
new TestRandomSQL().runTest(this);
new TestKillRestart().runTest(this);
......
/*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test;
......@@ -52,6 +52,9 @@ public abstract class TestBase {
}
public void runTest(TestAll conf) {
if (conf.networked) {
return;
}
try {
init(conf);
start = System.currentTimeMillis();
......
......@@ -5,8 +5,10 @@
package org.h2.test.db;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.StringTokenizer;
import org.h2.test.TestBase;
......@@ -17,17 +19,59 @@ public class TestFullText extends TestBase {
return;
}
test(false);
testPerformance(false);
String luceneFullTextClassName = "org.h2.fulltext.FullTextLucene";
try {
Class.forName(luceneFullTextClassName);
test(true);
testPerformance(true);
} catch (ClassNotFoundException e) {
this.println("Class not found, not tested: " + luceneFullTextClassName);
println("Class not found, not tested: " + luceneFullTextClassName);
// ok
}
}
private void testPerformance(boolean lucene) throws Exception {
deleteDb("fullText");
Connection conn = getConnection("fullText");
String prefix = lucene ? "FTL" : "FT";
Statement stat = conn.createStatement();
String className = lucene ? "FullTextLucene" : "FullText";
stat.execute("CREATE ALIAS IF NOT EXISTS " + prefix + "_INIT FOR \"org.h2.fulltext." + className + ".init\"");
stat.execute("CALL " + prefix + "_INIT()");
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("CREATE TABLE TEST AS SELECT * FROM INFORMATION_SCHEMA.HELP");
stat.execute("ALTER TABLE TEST ALTER COLUMN ID INT NOT NULL");
stat.execute("CREATE PRIMARY KEY ON TEST(ID)");
long time = System.currentTimeMillis();
stat.execute("CALL " + prefix + "_CREATE_INDEX('PUBLIC', 'TEST', NULL)");
println("Create index " + prefix + ": " + (System.currentTimeMillis() - time) + " ms");
PreparedStatement prep = conn.prepareStatement("SELECT * FROM " + prefix + "_SEARCH(?, 0, 0)");
time = System.currentTimeMillis();
ResultSet rs = stat.executeQuery("SELECT TEXT FROM TEST");
int count = 0;
while (rs.next()) {
String text = rs.getString(1);
StringTokenizer tokenizer = new StringTokenizer(text, " ()[].,;:-+*/!?=<>{}#@'\"~$_%&|");
while (tokenizer.hasMoreTokens()) {
String word = tokenizer.nextToken();
if (word.length() < 10) {
continue;
}
prep.setString(1, word);
ResultSet rs2 = prep.executeQuery();
while (rs2.next()) {
rs2.getString(1);
count++;
}
}
}
println("Search " + prefix + ": " + (System.currentTimeMillis() - time) + " ms, count: " + count);
stat.execute("CALL " + prefix + "_DROP_ALL()");
conn.close();
}
private void test(boolean lucene) throws Exception {
deleteDb("fullText");
Connection conn = getConnection("fullText");
......
......@@ -578,7 +578,7 @@ public class TestMetaData extends TestBase {
testResultSetOrdered(rs, new String[][] {
{ catalog, Constants.SCHEMA_MAIN, "TEST", "FALSE", catalog, "IDX_DATE",
"" + DatabaseMetaData.tableIndexOther, "1", "DATE_V", "A", "0", "0", "" },
{ catalog, Constants.SCHEMA_MAIN, "TEST", "FALSE", catalog, "PRIMARY_KEY_1",
{ catalog, Constants.SCHEMA_MAIN, "TEST", "FALSE", catalog, "PRIMARY_KEY_2",
"" + DatabaseMetaData.tableIndexOther, "1", "ID", "A", "0", "0", "" },
{ catalog, Constants.SCHEMA_MAIN, "TEST", "TRUE", catalog, "IDX_TEXT_DEC",
"" + DatabaseMetaData.tableIndexOther, "1", "TEXT_V", "A", "0", "0", "" },
......@@ -593,14 +593,14 @@ public class TestMetaData extends TestBase {
DataType.TYPE_BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER }, null, null);
testResultSetOrdered(rs, new String[][] { { catalog, Constants.SCHEMA_MAIN, "TEST", "FALSE", catalog,
"PRIMARY_KEY_1", "" + DatabaseMetaData.tableIndexOther, "1", "ID", "A", "0", "0", "" } });
"PRIMARY_KEY_2", "" + DatabaseMetaData.tableIndexOther, "1", "ID", "A", "0", "0", "" } });
trace("getPrimaryKeys");
rs = meta.getPrimaryKeys(null, null, "TEST");
testResultSetMeta(rs, 6, new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ",
"PK_NAME" }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
Types.VARCHAR }, null, null);
testResultSetOrdered(rs,
new String[][] { { catalog, Constants.SCHEMA_MAIN, "TEST", "ID", "1", "PRIMARY_KEY_1" }, });
new String[][] { { catalog, Constants.SCHEMA_MAIN, "TEST", "ID", "1", "PRIMARY_KEY_2" }, });
trace("getTables - using a wildcard");
stat.executeUpdate("CREATE TABLE T_2(B INT,A VARCHAR(6),C INT,PRIMARY KEY(C,A,B))");
stat.executeUpdate("CREATE TABLE TX2(B INT,A VARCHAR(6),C INT,PRIMARY KEY(C,A,B))");
......@@ -719,21 +719,21 @@ public class TestMetaData extends TestBase {
* null,
* null
*/},
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_3",
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_146",
"" + DatabaseMetaData.tableIndexOther, "1", "C", "A" /*
* ,
* null,
* null,
* null
*/},
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_3",
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_146",
"" + DatabaseMetaData.tableIndexOther, "2", "A", "A" /*
* ,
* null,
* null,
* null
*/},
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_3",
{ catalog, Constants.SCHEMA_MAIN, "TX2", "FALSE", catalog, "PRIMARY_KEY_146",
"" + DatabaseMetaData.tableIndexOther, "3", "B", "A"/*
* ,
* null,
......@@ -763,9 +763,9 @@ public class TestMetaData extends TestBase {
*/}, });
trace("getPrimaryKeys");
rs = meta.getPrimaryKeys(null, null, "T_2");
testResultSetOrdered(rs, new String[][] { { catalog, Constants.SCHEMA_MAIN, "T_2", "A", "2", "PRIMARY_KEY_2" },
{ catalog, Constants.SCHEMA_MAIN, "T_2", "B", "3", "PRIMARY_KEY_2" },
{ catalog, Constants.SCHEMA_MAIN, "T_2", "C", "1", "PRIMARY_KEY_2" }, });
testResultSetOrdered(rs, new String[][] { { catalog, Constants.SCHEMA_MAIN, "T_2", "A", "2", "PRIMARY_KEY_14" },
{ catalog, Constants.SCHEMA_MAIN, "T_2", "B", "3", "PRIMARY_KEY_14" },
{ catalog, Constants.SCHEMA_MAIN, "T_2", "C", "1", "PRIMARY_KEY_14" }, });
stat.executeUpdate("DROP TABLE TX2");
stat.executeUpdate("DROP TABLE T_2");
stat.executeUpdate("CREATE TABLE PARENT(ID INT PRIMARY KEY)");
......
......@@ -6,11 +6,16 @@ package org.h2.test.synth;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.BatchUpdateException;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
......@@ -33,7 +38,8 @@ import org.h2.util.RandomUtils;
*/
public class TestCrashAPI extends TestBase {
public static final Class[] INTERFACES = { Connection.class, PreparedStatement.class, Statement.class,
ResultSet.class, ResultSetMetaData.class, Savepoint.class };
ResultSet.class, ResultSetMetaData.class, Savepoint.class,
ParameterMetaData.class, Clob.class, Blob.class, Array.class, CallableStatement.class };
private ArrayList objects = new ArrayList();
private HashMap classMethods = new HashMap();
private RandomGen random = new RandomGen(null);
......@@ -376,7 +382,8 @@ public class TestCrashAPI extends TestBase {
}
public void test() throws Exception {
while (true) {
int len = getSize(2, 6);
for (int i = 0; i < len; i++) {
int seed = RandomUtils.nextInt(Integer.MAX_VALUE);
testCase(seed);
deleteDb();
......
......@@ -131,7 +131,7 @@ where t.bh_id=bh.id and bh.site='Hello' group by dir_num) as x
where cnt < 1000 order by dir_num asc;
> PLAN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT X.DIR_NUM, X.CNT FROM (SELECT DIR_NUM, COUNT(*) AS CNT FROM PUBLIC.MULTI_PAGES T /* PUBLIC.MULTI_PAGES_TABLE_SCAN */ INNER JOIN PUBLIC.B_HOLDING BH /* PUBLIC.PRIMARY_KEY_1: ID = T.BH_ID */ WHERE (BH.SITE = 'Hello') AND (T.BH_ID = BH.ID) GROUP BY DIR_NUM) X /* SELECT DIR_NUM, COUNT(*) AS CNT FROM PUBLIC.MULTI_PAGES T /++ PUBLIC.MULTI_PAGES_TABLE_SCAN ++/ INNER JOIN PUBLIC.B_HOLDING BH /++ PUBLIC.PRIMARY_KEY_1: ID = T.BH_ID ++/ WHERE (BH.SITE = 'Hello') AND (T.BH_ID = BH.ID) GROUP BY DIR_NUM HAVING COUNT(*) <= CAST(?1 AS BIGINT): CNT < 1000 */ WHERE CNT < 1000 ORDER BY 1
> SELECT X.DIR_NUM, X.CNT FROM (SELECT DIR_NUM, COUNT(*) AS CNT FROM PUBLIC.MULTI_PAGES T /* PUBLIC.MULTI_PAGES_TABLE_SCAN */ INNER JOIN PUBLIC.B_HOLDING BH /* PUBLIC.PRIMARY_KEY_3: ID = T.BH_ID */ WHERE (BH.SITE = 'Hello') AND (T.BH_ID = BH.ID) GROUP BY DIR_NUM) X /* SELECT DIR_NUM, COUNT(*) AS CNT FROM PUBLIC.MULTI_PAGES T /++ PUBLIC.MULTI_PAGES_TABLE_SCAN ++/ INNER JOIN PUBLIC.B_HOLDING BH /++ PUBLIC.PRIMARY_KEY_3: ID = T.BH_ID ++/ WHERE (BH.SITE = 'Hello') AND (T.BH_ID = BH.ID) GROUP BY DIR_NUM HAVING COUNT(*) <= CAST(?1 AS BIGINT): CNT < 1000 */ WHERE CNT < 1000 ORDER BY 1
> rows (ordered): 1
select dir_num, count(*) as cnt from multi_pages t, b_holding bh
......@@ -179,13 +179,13 @@ insert into test values(1), (2), (3);
explain select * from test where id = 1;
> PLAN
> -------------------------------------------------------------------------------
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ WHERE ID = 1
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ WHERE ID = 1
> rows: 1
EXPLAIN SELECT * FROM TEST WHERE ID = (SELECT MAX(ID) FROM TEST);
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = (SELECT MAX(ID) FROM PUBLIC.TEST /++ PUBLIC.TEST_TABLE_SCAN ++/ /++ direct lookup query ++/) */ WHERE ID = (SELECT MAX(ID) FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ /* direct lookup query */)
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = (SELECT MAX(ID) FROM PUBLIC.TEST /++ PUBLIC.TEST_TABLE_SCAN ++/ /++ direct lookup query ++/) */ WHERE ID = (SELECT MAX(ID) FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ /* direct lookup query */)
> rows: 1
drop table test;
......@@ -200,7 +200,7 @@ insert into test values(1), (2), (3);
explain select * from test where id = 3;
> PLAN
> -------------------------------------------------------------------------------
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 3 */ WHERE ID = 3
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 3 */ WHERE ID = 3
> rows: 1
explain select * from test where id = 255;
......@@ -221,7 +221,7 @@ insert into test values(1), (2), (3);
explain select * from test where id in(1, 2, null);
> PLAN
> -------------------------------------------------------------------------------------------------------
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2, NULL)
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2, NULL)
> rows: 1
drop table test;
......@@ -1111,7 +1111,7 @@ CREATE TABLE child(parentid int REFERENCES parent);
select * from INFORMATION_SCHEMA.CROSS_REFERENCES;
> PKTABLE_CATALOG PKTABLE_SCHEMA PKTABLE_NAME PKCOLUMN_NAME FKTABLE_CATALOG FKTABLE_SCHEMA FKTABLE_NAME FKCOLUMN_NAME ORDINAL_POSITION UPDATE_RULE DELETE_RULE FK_NAME PK_NAME DEFERRABILITY
> --------------- -------------- ------------ ------------- --------------- -------------- ------------ ------------- ---------------- ----------- ----------- ------------ ------- -------------
> SCRIPT PUBLIC PARENT ID SCRIPT PUBLIC CHILD PARENTID 1 1 1 CONSTRAINT_0 null 7
> SCRIPT PUBLIC PARENT ID SCRIPT PUBLIC CHILD PARENTID 1 1 1 CONSTRAINT_3 null 7
> rows: 1
ALTER TABLE parent ADD COLUMN name varchar;
......@@ -1120,7 +1120,7 @@ ALTER TABLE parent ADD COLUMN name varchar;
select * from INFORMATION_SCHEMA.CROSS_REFERENCES;
> PKTABLE_CATALOG PKTABLE_SCHEMA PKTABLE_NAME PKCOLUMN_NAME FKTABLE_CATALOG FKTABLE_SCHEMA FKTABLE_NAME FKCOLUMN_NAME ORDINAL_POSITION UPDATE_RULE DELETE_RULE FK_NAME PK_NAME DEFERRABILITY
> --------------- -------------- ------------ ------------- --------------- -------------- ------------ ------------- ---------------- ----------- ----------- ------------ ------- -------------
> SCRIPT PUBLIC PARENT ID SCRIPT PUBLIC CHILD PARENTID 1 1 1 CONSTRAINT_0 null 7
> SCRIPT PUBLIC PARENT ID SCRIPT PUBLIC CHILD PARENTID 1 1 1 CONSTRAINT_3 null 7
> rows: 1
drop table parent, child;
......@@ -1903,7 +1903,7 @@ where exists (select 1 from test t4 where t2.id=t4.id);
explain select * from test t1 where id in(select id from test t2 where t1.id=t2.id);
> PLAN
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE ID IN(SELECT ID FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T1.ID */ WHERE T1.ID = T2.ID)
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE ID IN(SELECT ID FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ WHERE T1.ID = T2.ID)
> rows: 1
select * from test t1 where id in(select id from test t2 where t1.id=t2.id);
......@@ -1955,7 +1955,7 @@ select * from test t1 where id in(select id from test);
explain select * from test t1 where id in(1, select max(id) from test);
> PLAN
> -----------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2)
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2)
> rows: 1
select * from test t1 where id in(1, select max(id) from test);
......@@ -1968,7 +1968,7 @@ select * from test t1 where id in(1, select max(id) from test);
explain select * from test t1 where id in(1, select max(id) from test t2 where t1.id=t2.id);
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE ID IN(1, (SELECT MAX(ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T1.ID */ WHERE T1.ID = T2.ID))
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE ID IN(1, (SELECT MAX(ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ WHERE T1.ID = T2.ID))
> rows: 1
select * from test t1 where id in(1, select max(id) from test t2 where t1.id=t2.id);
......@@ -2068,8 +2068,8 @@ explain select * from one natural join two left join two three on
one.id=three.id left join one four on two.id=four.id where three.val
is null or three.val>=DATE'2006-07-01';
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT ONE.ID, TWO.ID, TWO.VAL, THREE.ID, THREE.VAL, FOUR.ID FROM PUBLIC.ONE /* PUBLIC.ONE_TABLE_SCAN */ INNER JOIN PUBLIC.TWO /* PUBLIC.PRIMARY_KEY_2: ID = PUBLIC.ONE.ID AND ID = PUBLIC.ONE.ID */ /* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */ LEFT OUTER JOIN PUBLIC.TWO THREE /* PUBLIC.PRIMARY_KEY_2: ID = ONE.ID */ ON ONE.ID = THREE.ID LEFT OUTER JOIN PUBLIC.ONE FOUR /* PUBLIC.PRIMARY_KEY_1: ID = TWO.ID */ ON TWO.ID = FOUR.ID WHERE (PUBLIC.ONE.ID = PUBLIC.TWO.ID) AND ((THREE.VAL IS NULL) OR (THREE.VAL >= DATE '2006-07-01'))
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT ONE.ID, TWO.ID, TWO.VAL, THREE.ID, THREE.VAL, FOUR.ID FROM PUBLIC.ONE /* PUBLIC.ONE_TABLE_SCAN */ INNER JOIN PUBLIC.TWO /* PUBLIC.PRIMARY_KEY_14: ID = PUBLIC.ONE.ID AND ID = PUBLIC.ONE.ID */ /* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */ LEFT OUTER JOIN PUBLIC.TWO THREE /* PUBLIC.PRIMARY_KEY_14: ID = ONE.ID */ ON ONE.ID = THREE.ID LEFT OUTER JOIN PUBLIC.ONE FOUR /* PUBLIC.PRIMARY_KEY_13: ID = TWO.ID */ ON TWO.ID = FOUR.ID WHERE (PUBLIC.ONE.ID = PUBLIC.TWO.ID) AND ((THREE.VAL IS NULL) OR (THREE.VAL >= DATE '2006-07-01'))
> rows: 1
-- Query #4: same as #3, but the joins have been manually re-ordered
......@@ -2137,8 +2137,8 @@ inner join test2 on test1.id=test2.id left
outer join test3 on test2.id=test3.id
where test3.id is null;
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST1 /* PUBLIC.TEST1_TABLE_SCAN */ INNER JOIN PUBLIC.TEST2 /* PUBLIC.PRIMARY_KEY_2: ID = TEST1.ID AND ID = TEST1.ID */ /* WHERE TEST1.ID = TEST2.ID */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_3: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST1 /* PUBLIC.TEST1_TABLE_SCAN */ INNER JOIN PUBLIC.TEST2 /* PUBLIC.PRIMARY_KEY_4C: ID = TEST1.ID AND ID = TEST1.ID */ /* WHERE TEST1.ID = TEST2.ID */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> rows: 1
insert into test1 select x from system_range(2, 1000);
......@@ -2157,8 +2157,8 @@ inner join test2 on test1.id=test2.id
left outer join test3 on test2.id=test3.id
where test3.id is null;
> PLAN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2_TABLE_SCAN */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_3: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_1: ID = TEST2.ID */ WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST1.ID, TEST2.ID, TEST3.ID FROM PUBLIC.TEST2 /* PUBLIC.TEST2_TABLE_SCAN */ LEFT OUTER JOIN PUBLIC.TEST3 /* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ ON TEST2.ID = TEST3.ID INNER JOIN PUBLIC.TEST1 /* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ WHERE (TEST3.ID IS NULL) AND (TEST1.ID = TEST2.ID)
> rows: 1
SELECT TEST1.ID, TEST2.ID, TEST3.ID
......@@ -2356,8 +2356,8 @@ alter table test add constraint fk foreign key(parent) references(id);
select TABLE_NAME, NON_UNIQUE, INDEX_NAME, ORDINAL_POSITION, COLUMN_NAME, CARDINALITY, PRIMARY_KEY from INFORMATION_SCHEMA.INDEXES;
> TABLE_NAME NON_UNIQUE INDEX_NAME ORDINAL_POSITION COLUMN_NAME CARDINALITY PRIMARY_KEY
> ---------- ---------- ------------- ---------------- ----------- ----------- -----------
> TEST FALSE NU_INDEX_0 1 PARENT 0 FALSE
> TEST FALSE PRIMARY_KEY_1 1 ID 0 TRUE
> TEST FALSE NU_INDEX_2 1 PARENT 0 FALSE
> TEST FALSE PRIMARY_KEY_2 1 ID 0 TRUE
> TEST TRUE NI 1 PARENT 0 FALSE
> rows: 3
......@@ -2432,13 +2432,13 @@ insert into test values(1, 'Y');
> update count: 1
call select a from test order by id;
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */ ORDER BY =ID
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2 */ ORDER BY =ID
> -----------------------------------------------------------------
> TRUE
> rows (ordered): 1
select select a from test order by id;
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */ ORDER BY =ID
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2 */ ORDER BY =ID
> -----------------------------------------------------------------
> TRUE
> rows (ordered): 1
......@@ -2499,9 +2499,9 @@ script NOPASSWORDS NOSETTINGS;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.SP2;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.SP1 ADD CONSTRAINT PUBLIC.CONSTRAINT_1 FOREIGN KEY(S_NO) REFERENCES PUBLIC.S(S_NO) NOCHECK;
> ALTER TABLE PUBLIC.SP1 ADD CONSTRAINT PUBLIC.CONSTRAINT_2 FOREIGN KEY(P_NO) REFERENCES PUBLIC.P(P_NO) NOCHECK;
> ALTER TABLE PUBLIC.SP1 ADD CONSTRAINT PUBLIC.CONSTRAINT_14 FOREIGN KEY(P_NO) REFERENCES PUBLIC.P(P_NO) NOCHECK;
> ALTER TABLE PUBLIC.SP2 ADD CONSTRAINT PUBLIC.C1 FOREIGN KEY(S_NO) REFERENCES PUBLIC.S(S_NO) NOCHECK;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_0 FOREIGN KEY(PARENT) REFERENCES PUBLIC.TEST(ID) NOCHECK;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 FOREIGN KEY(PARENT) REFERENCES PUBLIC.TEST(ID) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.P( P_NO VARCHAR(5) NOT NULL, DESCR VARCHAR(16), COLOR VARCHAR(8) );
> CREATE MEMORY TABLE PUBLIC.S( S_NO VARCHAR(5) NOT NULL, NAME VARCHAR(16), CITY VARCHAR(16) );
> CREATE MEMORY TABLE PUBLIC.SP1( S_NO VARCHAR(5) NOT NULL, P_NO VARCHAR(5) NOT NULL, QTY INT );
......@@ -2623,7 +2623,7 @@ create table test(id int primary key);
explain select * from test a inner join test b left outer join test c on c.id = a.id;
> PLAN
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT A.ID, B.ID, C.ID FROM PUBLIC.TEST A /* PUBLIC.TEST_TABLE_SCAN */ INNER JOIN PUBLIC.TEST B /* PUBLIC.TEST_TABLE_SCAN */ LEFT OUTER JOIN PUBLIC.TEST C /* PUBLIC.PRIMARY_KEY_1: ID = A.ID */ ON C.ID = A.ID
> SELECT A.ID, B.ID, C.ID FROM PUBLIC.TEST A /* PUBLIC.TEST_TABLE_SCAN */ INNER JOIN PUBLIC.TEST B /* PUBLIC.TEST_TABLE_SCAN */ LEFT OUTER JOIN PUBLIC.TEST C /* PUBLIC.PRIMARY_KEY_2: ID = A.ID */ ON C.ID = A.ID
> rows: 1
SELECT T.ID FROM TEST "T";
......@@ -2797,7 +2797,7 @@ script NOPASSWORDS NOSETTINGS drop;
> CREATE SCHEMA S AUTHORIZATION SA;
> CREATE SEQUENCE S.SEQ START WITH 10;
> CREATE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints";
> CREATE UNIQUE INDEX S.CU_ID_INDEX_0 ON S.TEST(ID);
> CREATE UNIQUE INDEX S.CU_ID_INDEX_2 ON S.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS S.SEQ;
> DROP TABLE IF EXISTS S.TEST;
......@@ -3439,7 +3439,7 @@ CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
EXPLAIN SELECT * FROM TEST WHERE ID=1;
> PLAN
> ------------------------------------------------------------------------------------------
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ WHERE ID = 1
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ WHERE ID = 1
> rows: 1
EXPLAIN MERGE INTO TEST VALUES(1, 'Hello');
......@@ -3834,7 +3834,7 @@ explain update test set (id, name)=(id+1, name || 'Hi');
explain update test set (id, name)=(select id+1, name || 'Ho' from test t1 where test.id=t1.id);
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> UPDATE PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ SET ID = ARRAY_GET((SELECT (ID + 1), (NAME || 'Ho') FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID = TEST.ID */ WHERE TEST.ID = T1.ID), 1), NAME = ARRAY_GET((SELECT (ID + 1), (NAME || 'Ho') FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID = TEST.ID */ WHERE TEST.ID = T1.ID), 2)
> UPDATE PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ SET ID = ARRAY_GET((SELECT (ID + 1), (NAME || 'Ho') FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = TEST.ID */ WHERE TEST.ID = T1.ID), 1), NAME = ARRAY_GET((SELECT (ID + 1), (NAME || 'Ho') FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = TEST.ID */ WHERE TEST.ID = T1.ID), 2)
> rows: 1
select * from test;
......@@ -3891,19 +3891,19 @@ insert into b select id+10, p+10 from b;
explain select * from b b0, b b1, b b2 where b1.p = b0.id and b2.p = b1.id and b0.id=10;
> PLAN
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_1: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ WHERE (B0.ID = 10) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_4: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ WHERE (B0.ID = 10) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))
> rows: 1
explain select * from b b0, b b1, b b2, b b3 where b1.p = b0.id and b2.p = b1.id and b3.p = b2.id and b0.id=10;
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_1: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ WHERE (B0.ID = 10) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID)))
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_4: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ WHERE (B0.ID = 10) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID)))
> rows: 1
explain select * from b b0, b b1, b b2, b b3, b b4 where b1.p = b0.id and b2.p = b1.id and b3.p = b2.id and b4.p = b3.id and b0.id=10;
> PLAN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P, B4.ID, B4.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_1: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ /* WHERE B3.P = B2.ID */ INNER JOIN PUBLIC.B B4 /* PUBLIC.BP: P = B3.ID */ WHERE (B0.ID = 10) AND ((B4.P = B3.ID) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))))
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P, B4.ID, B4.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_4: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ /* WHERE B3.P = B2.ID */ INNER JOIN PUBLIC.B B4 /* PUBLIC.BP: P = B3.ID */ WHERE (B0.ID = 10) AND ((B4.P = B3.ID) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))))
> rows: 1
analyze;
......@@ -3912,7 +3912,7 @@ analyze;
explain select * from b b0, b b1, b b2, b b3, b b4 where b1.p = b0.id and b2.p = b1.id and b3.p = b2.id and b4.p = b3.id and b0.id=10;
> PLAN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P, B4.ID, B4.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_1: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ /* WHERE B3.P = B2.ID */ INNER JOIN PUBLIC.B B4 /* PUBLIC.BP: P = B3.ID */ WHERE (B0.ID = 10) AND ((B4.P = B3.ID) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))))
> SELECT B0.ID, B0.P, B1.ID, B1.P, B2.ID, B2.P, B3.ID, B3.P, B4.ID, B4.P FROM PUBLIC.B B0 /* PUBLIC.PRIMARY_KEY_4: ID = 10 */ /* WHERE B0.ID = 10 */ INNER JOIN PUBLIC.B B1 /* PUBLIC.BP: P = B0.ID */ /* WHERE B1.P = B0.ID */ INNER JOIN PUBLIC.B B2 /* PUBLIC.BP: P = B1.ID */ /* WHERE B2.P = B1.ID */ INNER JOIN PUBLIC.B B3 /* PUBLIC.BP: P = B2.ID */ /* WHERE B3.P = B2.ID */ INNER JOIN PUBLIC.B B4 /* PUBLIC.BP: P = B3.ID */ WHERE (B0.ID = 10) AND ((B4.P = B3.ID) AND ((B3.P = B2.ID) AND ((B1.P = B0.ID) AND (B2.P = B1.ID))))
> rows: 1
drop table if exists b;
......@@ -3941,7 +3941,7 @@ insert into test values
EXPLAIN SELECT * FROM TEST WHERE ID = 3;
> PLAN
> -----------------------------------------------------------------------------------------------------------------------
> SELECT TEST.ID, TEST.FIRST_NAME, TEST.NAME, TEST.STATE FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 3 */ WHERE ID = 3
> SELECT TEST.ID, TEST.FIRST_NAME, TEST.NAME, TEST.STATE FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 3 */ WHERE ID = 3
> rows: 1
SELECT SELECTIVITY(ID), SELECTIVITY(FIRST_NAME),
......@@ -3981,7 +3981,7 @@ WHERE 1=J.X and J.Y=I.X AND I.Y=H.X AND H.Y=G.X AND G.Y=F.X AND F.Y=E.X
AND E.Y=D.X AND D.Y=C.X AND C.Y=B.X AND B.Y=A.X;
> PLAN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT A.X FROM PUBLIC.O J /* PUBLIC.PRIMARY_KEY_1: X = 1 */ /* WHERE 1 = J.X */ INNER JOIN PUBLIC.O I /* PUBLIC.PRIMARY_KEY_1: X = J.Y */ /* WHERE J.Y = I.X */ INNER JOIN PUBLIC.O H /* PUBLIC.PRIMARY_KEY_1: X = I.Y */ /* WHERE I.Y = H.X */ INNER JOIN PUBLIC.O G /* PUBLIC.PRIMARY_KEY_1: X = H.Y */ /* WHERE H.Y = G.X */ INNER JOIN PUBLIC.O F /* PUBLIC.PRIMARY_KEY_1: X = G.Y */ /* WHERE G.Y = F.X */ INNER JOIN PUBLIC.O E /* PUBLIC.PRIMARY_KEY_1: X = F.Y */ /* WHERE F.Y = E.X */ INNER JOIN PUBLIC.O D /* PUBLIC.PRIMARY_KEY_1: X = E.Y */ /* WHERE E.Y = D.X */ INNER JOIN PUBLIC.O C /* PUBLIC.PRIMARY_KEY_1: X = D.Y */ /* WHERE D.Y = C.X */ INNER JOIN PUBLIC.O B /* PUBLIC.PRIMARY_KEY_1: X = C.Y */ /* WHERE C.Y = B.X */ INNER JOIN PUBLIC.O A /* PUBLIC.PRIMARY_KEY_1: X = B.Y */ WHERE (B.Y = A.X) AND ((C.Y = B.X) AND ((D.Y = C.X) AND ((E.Y = D.X) AND ((F.Y = E.X) AND ((G.Y = F.X) AND ((H.Y = G.X) AND ((I.Y = H.X) AND ((1 = J.X) AND (J.Y = I.X)))))))))
> SELECT A.X FROM PUBLIC.O J /* PUBLIC.PRIMARY_KEY_4: X = 1 */ /* WHERE 1 = J.X */ INNER JOIN PUBLIC.O I /* PUBLIC.PRIMARY_KEY_4: X = J.Y */ /* WHERE J.Y = I.X */ INNER JOIN PUBLIC.O H /* PUBLIC.PRIMARY_KEY_4: X = I.Y */ /* WHERE I.Y = H.X */ INNER JOIN PUBLIC.O G /* PUBLIC.PRIMARY_KEY_4: X = H.Y */ /* WHERE H.Y = G.X */ INNER JOIN PUBLIC.O F /* PUBLIC.PRIMARY_KEY_4: X = G.Y */ /* WHERE G.Y = F.X */ INNER JOIN PUBLIC.O E /* PUBLIC.PRIMARY_KEY_4: X = F.Y */ /* WHERE F.Y = E.X */ INNER JOIN PUBLIC.O D /* PUBLIC.PRIMARY_KEY_4: X = E.Y */ /* WHERE E.Y = D.X */ INNER JOIN PUBLIC.O C /* PUBLIC.PRIMARY_KEY_4: X = D.Y */ /* WHERE D.Y = C.X */ INNER JOIN PUBLIC.O B /* PUBLIC.PRIMARY_KEY_4: X = C.Y */ /* WHERE C.Y = B.X */ INNER JOIN PUBLIC.O A /* PUBLIC.PRIMARY_KEY_4: X = B.Y */ WHERE (B.Y = A.X) AND ((C.Y = B.X) AND ((D.Y = C.X) AND ((E.Y = D.X) AND ((F.Y = E.X) AND ((G.Y = F.X) AND ((H.Y = G.X) AND ((I.Y = H.X) AND ((1 = J.X) AND (J.Y = I.X)))))))))
> rows: 1
DROP TABLE O;
......@@ -4012,7 +4012,7 @@ WHERE AID=A.ID AND BID=B.ID AND CID=C.ID
AND DID=D.ID AND EID=E.ID AND FID=F.ID AND GID=G.ID AND HID=H.ID;
> PLAN
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT COUNT(*) FROM PUBLIC.PARENT /* PUBLIC.PARENT_TABLE_SCAN */ INNER JOIN PUBLIC.CHILD A /* PUBLIC.PRIMARY_KEY_2: ID = AID */ /* WHERE AID = A.ID */ INNER JOIN PUBLIC.CHILD B /* PUBLIC.PRIMARY_KEY_2: ID = BID */ /* WHERE BID = B.ID */ INNER JOIN PUBLIC.CHILD C /* PUBLIC.PRIMARY_KEY_2: ID = CID */ /* WHERE CID = C.ID */ INNER JOIN PUBLIC.CHILD D /* PUBLIC.PRIMARY_KEY_2: ID = DID */ /* WHERE DID = D.ID */ INNER JOIN PUBLIC.CHILD E /* PUBLIC.PRIMARY_KEY_2: ID = EID */ /* WHERE EID = E.ID */ INNER JOIN PUBLIC.CHILD F /* PUBLIC.PRIMARY_KEY_2: ID = FID */ /* WHERE FID = F.ID */ INNER JOIN PUBLIC.CHILD G /* PUBLIC.PRIMARY_KEY_2: ID = GID */ /* WHERE GID = G.ID */ INNER JOIN PUBLIC.CHILD H /* PUBLIC.PRIMARY_KEY_2: ID = HID */ WHERE (HID = H.ID) AND ((GID = G.ID) AND ((FID = F.ID) AND ((EID = E.ID) AND ((DID = D.ID) AND ((CID = C.ID) AND ((AID = A.ID) AND (BID = B.ID)))))))
> SELECT COUNT(*) FROM PUBLIC.PARENT /* PUBLIC.PARENT_TABLE_SCAN */ INNER JOIN PUBLIC.CHILD A /* PUBLIC.PRIMARY_KEY_3: ID = AID */ /* WHERE AID = A.ID */ INNER JOIN PUBLIC.CHILD B /* PUBLIC.PRIMARY_KEY_3: ID = BID */ /* WHERE BID = B.ID */ INNER JOIN PUBLIC.CHILD C /* PUBLIC.PRIMARY_KEY_3: ID = CID */ /* WHERE CID = C.ID */ INNER JOIN PUBLIC.CHILD D /* PUBLIC.PRIMARY_KEY_3: ID = DID */ /* WHERE DID = D.ID */ INNER JOIN PUBLIC.CHILD E /* PUBLIC.PRIMARY_KEY_3: ID = EID */ /* WHERE EID = E.ID */ INNER JOIN PUBLIC.CHILD F /* PUBLIC.PRIMARY_KEY_3: ID = FID */ /* WHERE FID = F.ID */ INNER JOIN PUBLIC.CHILD G /* PUBLIC.PRIMARY_KEY_3: ID = GID */ /* WHERE GID = G.ID */ INNER JOIN PUBLIC.CHILD H /* PUBLIC.PRIMARY_KEY_3: ID = HID */ WHERE (HID = H.ID) AND ((GID = G.ID) AND ((FID = F.ID) AND ((EID = E.ID) AND ((DID = D.ID) AND ((CID = C.ID) AND ((AID = A.ID) AND (BID = B.ID)))))))
> rows: 1
CREATE TABLE FAMILY(ID INT PRIMARY KEY, PARENTID INT);
......@@ -4026,7 +4026,7 @@ WHERE FAMILY.ID=1 AND FAMILY.PARENTID=PARENT.ID
AND AID=A.ID AND BID=B.ID AND CID=C.ID AND DID=D.ID AND EID=E.ID AND FID=F.ID AND GID=G.ID;
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT COUNT(*) FROM PUBLIC.FAMILY /* PUBLIC.PRIMARY_KEY_3: ID = 1 */ /* WHERE FAMILY.ID = 1 */ INNER JOIN PUBLIC.PARENT /* PUBLIC.PRIMARY_KEY_1: ID = FAMILY.PARENTID */ /* WHERE FAMILY.PARENTID = PARENT.ID */ INNER JOIN PUBLIC.CHILD A /* PUBLIC.PRIMARY_KEY_2: ID = AID */ /* WHERE AID = A.ID */ INNER JOIN PUBLIC.CHILD B /* PUBLIC.PRIMARY_KEY_2: ID = BID */ /* WHERE BID = B.ID */ INNER JOIN PUBLIC.CHILD C /* PUBLIC.PRIMARY_KEY_2: ID = CID */ /* WHERE CID = C.ID */ INNER JOIN PUBLIC.CHILD D /* PUBLIC.PRIMARY_KEY_2: ID = DID */ /* WHERE DID = D.ID */ INNER JOIN PUBLIC.CHILD E /* PUBLIC.PRIMARY_KEY_2: ID = EID */ /* WHERE EID = E.ID */ INNER JOIN PUBLIC.CHILD F /* PUBLIC.PRIMARY_KEY_2: ID = FID */ /* WHERE FID = F.ID */ INNER JOIN PUBLIC.CHILD G /* PUBLIC.PRIMARY_KEY_2: ID = GID */ WHERE (GID = G.ID) AND ((FID = F.ID) AND ((EID = E.ID) AND ((DID = D.ID) AND ((CID = C.ID) AND ((BID = B.ID) AND ((AID = A.ID) AND ((FAMILY.ID = 1) AND (FAMILY.PARENTID = PARENT.ID))))))))
> SELECT COUNT(*) FROM PUBLIC.FAMILY /* PUBLIC.PRIMARY_KEY_7: ID = 1 */ /* WHERE FAMILY.ID = 1 */ INNER JOIN PUBLIC.PARENT /* PUBLIC.PRIMARY_KEY_8: ID = FAMILY.PARENTID */ /* WHERE FAMILY.PARENTID = PARENT.ID */ INNER JOIN PUBLIC.CHILD A /* PUBLIC.PRIMARY_KEY_3: ID = AID */ /* WHERE AID = A.ID */ INNER JOIN PUBLIC.CHILD B /* PUBLIC.PRIMARY_KEY_3: ID = BID */ /* WHERE BID = B.ID */ INNER JOIN PUBLIC.CHILD C /* PUBLIC.PRIMARY_KEY_3: ID = CID */ /* WHERE CID = C.ID */ INNER JOIN PUBLIC.CHILD D /* PUBLIC.PRIMARY_KEY_3: ID = DID */ /* WHERE DID = D.ID */ INNER JOIN PUBLIC.CHILD E /* PUBLIC.PRIMARY_KEY_3: ID = EID */ /* WHERE EID = E.ID */ INNER JOIN PUBLIC.CHILD F /* PUBLIC.PRIMARY_KEY_3: ID = FID */ /* WHERE FID = F.ID */ INNER JOIN PUBLIC.CHILD G /* PUBLIC.PRIMARY_KEY_3: ID = GID */ WHERE (GID = G.ID) AND ((FID = F.ID) AND ((EID = E.ID) AND ((DID = D.ID) AND ((CID = C.ID) AND ((BID = B.ID) AND ((AID = A.ID) AND ((FAMILY.ID = 1) AND (FAMILY.PARENTID = PARENT.ID))))))))
> rows: 1
DROP TABLE FAMILY;
......@@ -4534,7 +4534,7 @@ SELECT LIMIT (1+0) (2+0) NAME, -ID, ID _ID_ FROM TEST ORDER BY _ID_;
EXPLAIN SELECT LIMIT (1+0) (2+0) * FROM TEST ORDER BY ID;
> PLAN
> -------------------------------------------------------------------------------------------------
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */ ORDER BY 1 LIMIT 2 OFFSET 1
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2 */ ORDER BY 1 LIMIT 2 OFFSET 1
> rows (ordered): 1
SELECT * FROM TEST ORDER BY ID LIMIT 2+0 OFFSET 1+0;
......@@ -4585,7 +4585,7 @@ EXPLAIN SELECT * FROM TEST UNION ALL SELECT * FROM TEST ORDER BY ID LIMIT 2+0 OF
EXPLAIN DELETE FROM TEST WHERE ID=1;
> PLAN
> -----------------------------------------------------------------------
> DELETE FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ WHERE ID = 1
> DELETE FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ WHERE ID = 1
> rows: 1
DROP TABLE TEST;
......@@ -4606,7 +4606,7 @@ SELECT * FROM TEST2COL WHERE A=0 AND B=0;
EXPLAIN SELECT * FROM TEST2COL WHERE A=0 AND B=0;
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT TEST2COL.A, TEST2COL.B, TEST2COL.C FROM PUBLIC.TEST2COL /* PUBLIC.PRIMARY_KEY_1: A = 0 AND B = 0 */ WHERE ((A = 0) AND (B = 0)) AND (A = B)
> SELECT TEST2COL.A, TEST2COL.B, TEST2COL.C FROM PUBLIC.TEST2COL /* PUBLIC.PRIMARY_KEY_E: A = 0 AND B = 0 */ WHERE ((A = 0) AND (B = 0)) AND (A = B)
> rows: 1
SELECT * FROM TEST2COL WHERE A=0;
......@@ -4619,7 +4619,7 @@ SELECT * FROM TEST2COL WHERE A=0;
EXPLAIN SELECT * FROM TEST2COL WHERE A=0;
> PLAN
> ------------------------------------------------------------------------------------------------------------
> SELECT TEST2COL.A, TEST2COL.B, TEST2COL.C FROM PUBLIC.TEST2COL /* PUBLIC.PRIMARY_KEY_1: A = 0 */ WHERE A = 0
> SELECT TEST2COL.A, TEST2COL.B, TEST2COL.C FROM PUBLIC.TEST2COL /* PUBLIC.PRIMARY_KEY_E: A = 0 */ WHERE A = 0
> rows: 1
SELECT * FROM TEST2COL WHERE B=0;
......@@ -4799,7 +4799,7 @@ EXPLAIN SELECT TOP 1 * FROM TEST FOR UPDATE;
EXPLAIN SELECT COUNT(NAME) FROM TEST WHERE ID=1;
> PLAN
> -----------------------------------------------------------------------------------
> SELECT COUNT(NAME) FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ WHERE ID = 1
> SELECT COUNT(NAME) FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ WHERE ID = 1
> rows: 1
EXPLAIN SELECT * FROM TEST WHERE (ID>=1 AND ID<=2) OR (ID>0 AND ID<3) AND (ID<>6) ORDER BY NAME NULLS FIRST, 1 NULLS LAST, (1+1) DESC;
......@@ -4811,7 +4811,7 @@ EXPLAIN SELECT * FROM TEST WHERE (ID>=1 AND ID<=2) OR (ID>0 AND ID<3) AND (ID<>
EXPLAIN SELECT * FROM TEST WHERE ID=1 GROUP BY NAME, ID;
> PLAN
> ------------------------------------------------------------------------------------------------------------
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ WHERE ID = 1 GROUP BY NAME, ID
> SELECT TEST.ID, TEST.NAME FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ WHERE ID = 1 GROUP BY NAME, ID
> rows: 1
EXPLAIN PLAN FOR UPDATE TEST SET NAME='Hello', ID=1 WHERE NAME LIKE 'T%' ESCAPE 'x';
......@@ -4835,31 +4835,31 @@ EXPLAIN PLAN FOR SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) >
EXPLAIN PLAN FOR SELECT * FROM test t1 inner join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
> PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ /* WHERE T1.ID = 1 */ INNER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T1.ID AND ID = T1.ID */ WHERE (T1.ID = 1) AND ((T2.NAME IS NOT NULL) AND (T1.ID = T2.ID))
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ INNER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID AND ID = T1.ID */ WHERE (T1.ID = 1) AND ((T2.NAME IS NOT NULL) AND (T1.ID = T2.ID))
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM test t1 left outer join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ /* WHERE T1.ID = 1 */ LEFT OUTER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T1.ID */ ON (T2.NAME IS NOT NULL) AND (T1.ID = T2.ID) WHERE T1.ID = 1
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ LEFT OUTER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ ON (T2.NAME IS NOT NULL) AND (T1.ID = T2.ID) WHERE T1.ID = 1
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM test t1 left outer join test t2 on t1.id=t2.id and t2.name is null where t1.id=1;
> PLAN
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID = 1 */ /* WHERE T1.ID = 1 */ LEFT OUTER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T1.ID */ ON (T2.NAME IS NULL) AND (T1.ID = T2.ID) WHERE T1.ID = 1
> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ LEFT OUTER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ ON (T2.NAME IS NULL) AND (T1.ID = T2.ID) WHERE T1.ID = 1
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM TEST T1 WHERE EXISTS(SELECT * FROM TEST T2 WHERE T1.ID-1 = T2.ID);
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE EXISTS(SELECT T2.ID, T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = (T1.ID - 1) */ WHERE (T1.ID - 1) = T2.ID)
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.TEST_TABLE_SCAN */ WHERE EXISTS(SELECT T2.ID, T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = (T1.ID - 1) */ WHERE (T1.ID - 1) = T2.ID)
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM TEST T1 WHERE ID IN(1, 2);
> PLAN
> -----------------------------------------------------------------------------------------------------------
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_1: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2)
> SELECT T1.ID, T1.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID >= 1 AND ID <= 2 */ WHERE ID IN(1, 2)
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM TEST T1 WHERE ID IN(SELECT ID FROM TEST);
......@@ -5115,7 +5115,7 @@ SELECT * FROM V_UNION WHERE ID=1;
EXPLAIN SELECT * FROM V_UNION WHERE ID=1;
> PLAN
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT V_UNION.ID, V_UNION.NAME, V_UNION.CLASS FROM PUBLIC.V_UNION /* (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_1: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)) UNION ALL (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_1: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)): ID = 1 */ WHERE ID = 1
> SELECT V_UNION.ID, V_UNION.NAME, V_UNION.CLASS FROM PUBLIC.V_UNION /* (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_9: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)) UNION ALL (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_9: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)): ID = 1 */ WHERE ID = 1
> rows: 1
CREATE VIEW V_EXCEPT AS SELECT * FROM CHILDREN EXCEPT SELECT * FROM CHILDREN WHERE ID=2;
......@@ -5130,7 +5130,7 @@ SELECT * FROM V_EXCEPT WHERE ID=1;
EXPLAIN SELECT * FROM V_EXCEPT WHERE ID=1;
> PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT V_EXCEPT.ID, V_EXCEPT.NAME, V_EXCEPT.CLASS FROM PUBLIC.V_EXCEPT /* (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_1: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)) EXCEPT (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_1: ID = 2 ++/ WHERE ID = 2): ID = 1 */ WHERE ID = 1
> SELECT V_EXCEPT.ID, V_EXCEPT.NAME, V_EXCEPT.CLASS FROM PUBLIC.V_EXCEPT /* (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_9: ID = CAST(?1 AS INTEGER) ++/ WHERE CHILDREN.ID = CAST(?1 AS INTEGER)) EXCEPT (SELECT CHILDREN.ID, CHILDREN.NAME, CHILDREN.CLASS FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_9: ID = 2 ++/ WHERE ID = 2): ID = 1 */ WHERE ID = 1
> rows: 1
CREATE VIEW V_INTERSECT AS SELECT ID, NAME FROM CHILDREN INTERSECT SELECT * FROM CLASSES;
......@@ -5144,7 +5144,7 @@ SELECT * FROM V_INTERSECT WHERE ID=1;
EXPLAIN SELECT * FROM V_INTERSECT WHERE ID=1;
> PLAN
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> SELECT V_INTERSECT.ID, V_INTERSECT.NAME FROM PUBLIC.V_INTERSECT /* (SELECT ID, NAME FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_1: ID = CAST(?1 AS INTEGER) ++/ WHERE ID = CAST(?1 AS INTEGER)) INTERSECT (SELECT CLASSES.ID, CLASSES.NAME FROM PUBLIC.CLASSES /++ PUBLIC.PRIMARY_KEY_2: ID = CAST(?1 AS INTEGER) ++/ WHERE CLASSES.ID = CAST(?1 AS INTEGER)): ID = 1 */ WHERE ID = 1
> SELECT V_INTERSECT.ID, V_INTERSECT.NAME FROM PUBLIC.V_INTERSECT /* (SELECT ID, NAME FROM PUBLIC.CHILDREN /++ PUBLIC.PRIMARY_KEY_9: ID = CAST(?1 AS INTEGER) ++/ WHERE ID = CAST(?1 AS INTEGER)) INTERSECT (SELECT CLASSES.ID, CLASSES.NAME FROM PUBLIC.CLASSES /++ PUBLIC.PRIMARY_KEY_5: ID = CAST(?1 AS INTEGER) ++/ WHERE CLASSES.ID = CAST(?1 AS INTEGER)): ID = 1 */ WHERE ID = 1
> rows: 1
DROP VIEW V_UNION;
......@@ -5252,9 +5252,9 @@ CREATE VIEW TEST_A_SUB AS SELECT * FROM TEST_A WHERE ID < 2;
SELECT TABLE_NAME, SQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='VIEW';
> TABLE_NAME SQL
> ---------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> TEST_ALL CREATE FORCE VIEW PUBLIC.TEST_ALL(AID, A_NAME, BID, B_NAME) AS SELECT A.ID AS AID, A.NAME AS A_NAME, B.ID AS BID, B.NAME AS B_NAME FROM PUBLIC.TEST_A A /* PUBLIC.TEST_A_TABLE_SCAN */ INNER JOIN PUBLIC.TEST_B B /* PUBLIC.PRIMARY_KEY_2: ID = A.ID */ WHERE A.ID = B.ID
> TEST_A_SUB CREATE FORCE VIEW PUBLIC.TEST_A_SUB(ID, NAME) AS SELECT TEST_A.ID, TEST_A.NAME FROM PUBLIC.TEST_A /* PUBLIC.PRIMARY_KEY_1: ID < 2 */ WHERE ID < 2
> ---------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> TEST_ALL CREATE FORCE VIEW PUBLIC.TEST_ALL(AID, A_NAME, BID, B_NAME) AS SELECT A.ID AS AID, A.NAME AS A_NAME, B.ID AS BID, B.NAME AS B_NAME FROM PUBLIC.TEST_A A /* PUBLIC.TEST_A_TABLE_SCAN */ INNER JOIN PUBLIC.TEST_B B /* PUBLIC.PRIMARY_KEY_93: ID = A.ID */ WHERE A.ID = B.ID
> TEST_A_SUB CREATE FORCE VIEW PUBLIC.TEST_A_SUB(ID, NAME) AS SELECT TEST_A.ID, TEST_A.NAME FROM PUBLIC.TEST_A /* PUBLIC.PRIMARY_KEY_9: ID < 2 */ WHERE ID < 2
> rows: 2
SELECT * FROM TEST_A_SUB WHERE NAME IS NOT NULL;
......@@ -5810,7 +5810,7 @@ SELECT * FROM TEST T WHERE T.ID = (SELECT T2.ID FROM TEST T2 WHERE T2.ID=T.ID);
> rows: 3
SELECT (SELECT T2.NAME FROM TEST T2 WHERE T2.ID=T.ID), T.NAME FROM TEST T;
> SELECT T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T.ID */ WHERE T2.ID = T.ID NAME
> SELECT T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T.ID */ WHERE T2.ID = T.ID NAME
> ------------------------------------------------------------------------------------------- -----
> Hello Hello
> World World
......@@ -5818,7 +5818,7 @@ SELECT (SELECT T2.NAME FROM TEST T2 WHERE T2.ID=T.ID), T.NAME FROM TEST T;
> rows: 3
SELECT (SELECT SUM(T2.ID) FROM TEST T2 WHERE T2.ID>T.ID), T.ID FROM TEST T;
> SELECT SUM(T2.ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID > T.ID */ WHERE T2.ID > T.ID ID
> SELECT SUM(T2.ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID > T.ID */ WHERE T2.ID > T.ID ID
> ---------------------------------------------------------------------------------------------- --
> 2 1
> 3 0
......@@ -6903,7 +6903,7 @@ SCRIPT NOPASSWORDS NOSETTINGS;
> ------------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.CHILD;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.PARENT;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_0 FOREIGN KEY(PARENT_ID) REFERENCES PUBLIC.PARENT(ID) NOCHECK;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 FOREIGN KEY(PARENT_ID) REFERENCES PUBLIC.PARENT(ID) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENT_ID INT );
> CREATE MEMORY TABLE PUBLIC.PARENT( ID INT NOT NULL );
> CREATE PRIMARY KEY ON PUBLIC.PARENT(ID);
......@@ -7112,7 +7112,7 @@ SCRIPT NOPASSWORDS NOSETTINGS;
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.MIN_LENGTH CHECK(LENGTH(A_VARCHAR) > 1) NOCHECK;
> ALTER TABLE PUBLIC.B_TEST ADD CONSTRAINT PUBLIC.B_UNIQUE UNIQUE(B_INT);
> ALTER TABLE PUBLIC.B_TEST ADD CONSTRAINT PUBLIC.C3 FOREIGN KEY(B_INT) REFERENCES PUBLIC.A_TEST(A_INT) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT NOCHECK;
> ALTER TABLE PUBLIC.B_TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_0 CHECK(LENGTH(B_VARCHAR) > 1) NOCHECK;
> ALTER TABLE PUBLIC.B_TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_7 CHECK(LENGTH(B_VARCHAR) > 1) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.A_TEST( A_INT INT NOT NULL, A_VARCHAR VARCHAR(255) DEFAULT 'x', A_DATE DATE, A_DECIMAL DECIMAL(10, 2) );
> CREATE MEMORY TABLE PUBLIC.B_TEST( B_INT INT DEFAULT -1 NOT NULL, B_VARCHAR VARCHAR(255) DEFAULT NULL );
> CREATE PRIMARY KEY ON PUBLIC.A_TEST(A_INT);
......@@ -7209,7 +7209,7 @@ SCRIPT NOPASSWORDS NOSETTINGS;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.FAMILY;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.PARENT;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.CHILD;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_0 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.PARENT_CHILD FOREIGN KEY(PARENTID, FAMILY_ID) REFERENCES PUBLIC.PARENT(ID, FAMILY_ID) ON DELETE SET NULL ON UPDATE CASCADE NOCHECK;
> ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK;
> CREATE INDEX PUBLIC.FAMILY_ID_NAME ON PUBLIC.FAMILY(ID, NAME);
......@@ -7234,7 +7234,7 @@ SCRIPT NOPASSWORDS NOSETTINGS;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.FAMILY;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.PARENT;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.CHILD;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_0 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK;
> CREATE INDEX PUBLIC.FAMILY_ID_NAME ON PUBLIC.FAMILY(ID, NAME);
> CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENTID INT, FAMILY_ID INT, NAME VARCHAR(20) );
......@@ -7314,7 +7314,7 @@ SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_0 FOREIGN KEY(B) REFERENCES PUBLIC.TEST(A) NOCHECK;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 FOREIGN KEY(B) REFERENCES PUBLIC.TEST(A) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.TEST( A INT, B INT );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 4
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论