提交 34d36553 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 5d7da357
......@@ -40,7 +40,13 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3>
<h3>Version 1.0.59 (2007-09-TODO)</h3><ul>
<li>When using a subquery with group by as a table, some columns could not be used in the where condition
<li>When creating a table using CREATE TABLE .. AS SELECT, the precision for some data types (for example VARCHAR)
was set to the default precision. Fixed.
</li><li>When using the (undocumented) in-memory file system (jdbc:h2:memFS:x or jdbc:h2:memLZF:x), and using
multiple connections, a ConcurrentModificationException could occur. Fixed.
</li><li>REGEXP compatibility: So far String.matches was used, but for compatibility with MySQL, now Matcher.find is used.
</li><li>SCRIPT: the SQL statements in the result set now include the terminating semicolon as well. Simplifies copy and paste.
</li><li>When using a subquery with group by as a table, some columns could not be used in the where condition
in the outer query. Example: SELECT * FROM (SELECT ID, COUNT(*) C FROM TEST) WHERE C > 100. Fixed.
</li><li>Views with subqueries as tables and queries with nested subqueries as tables did not always work. Fixed.
</li><li>Compatibility: comparing columns with constants that are out of range does not throw an exception.
......
......@@ -186,7 +186,8 @@ public class CreateTable extends SchemaCommand {
String name = expr.getColumnName();
long precision = expr.getPrecision();
DataType dt = DataType.getDataType(type);
if (precision > 0 && (dt.defaultPrecision == 0 || dt.defaultPrecision > precision)) {
if (precision > 0 && (dt.defaultPrecision == 0 || (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
// dont' set precision to MAX_VALUE if this is the default
precision = dt.defaultPrecision;
}
int scale = expr.getScale();
......
......@@ -304,13 +304,9 @@ public class ScriptCommand extends ScriptBase {
private int writeLobStream(ValueLob v) throws IOException, SQLException {
if (!tempLobTableCreated) {
add(
"CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT, PART INT, CDATA VARCHAR, BDATA BINARY, PRIMARY KEY(ID, PART))",
true);
add("CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR \"" + this.getClass().getName() + ".combineClob\"",
true);
add("CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR \"" + this.getClass().getName() + ".combineBlob\"",
true);
add("CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT, PART INT, CDATA VARCHAR, BDATA BINARY, PRIMARY KEY(ID, PART))", true);
add("CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR \"" + this.getClass().getName() + ".combineClob\"", true);
add("CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR \"" + this.getClass().getName() + ".combineBlob\"", true);
tempLobTableCreated = true;
}
int id = nextLobId++;
......@@ -405,8 +401,9 @@ public class ScriptCommand extends ScriptBase {
if (s == null) {
return;
}
s += ";";
if (out != null) {
byte[] buff = StringUtils.utf8Encode(s + ";");
byte[] buff = StringUtils.utf8Encode(s);
int len = MathUtils.roundUp(buff.length + lineSeparator.length, Constants.FILE_BLOCK_SIZE);
buffer = ByteUtils.copy(buff, buffer);
......
......@@ -8,6 +8,8 @@ import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Properties;
import org.h2.api.DatabaseEventListener;
import org.h2.command.dml.SetTypes;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
......@@ -164,6 +166,17 @@ public class ConnectionInfo {
}
}
}
DatabaseEventListener removeDatabaseEventListenerObject() throws SQLException {
Object p = prop.remove("DATABASE_EVENT_LISTENER_OBJECT");
if (p == null) {
return null;
}
if (p instanceof DatabaseEventListener) {
return (DatabaseEventListener) p;
}
throw Message.getSQLException(ErrorCode.DATA_CONVERSION_ERROR_1, p.getClass().getName());
}
private char[] removePassword() {
Object p = prop.remove("PASSWORD");
......
......@@ -153,15 +153,18 @@ public class Database implements DataHandler {
this.fileLockMethod = FileLock.getFileLockMethod(lockMethodName);
this.textStorage = ci.getTextStorage();
this.databaseURL = ci.getURL();
String listener = ci.removeProperty("DATABASE_EVENT_LISTENER", null);
if (listener != null) {
if (listener.startsWith("'")) {
listener = listener.substring(1);
}
if (listener.endsWith("'")) {
listener = listener.substring(0, listener.length() - 1);
this.eventListener = ci.removeDatabaseEventListenerObject();
if (eventListener == null) {
String listener = ci.removeProperty("DATABASE_EVENT_LISTENER", null);
if (listener != null) {
if (listener.startsWith("'")) {
listener = listener.substring(1);
}
if (listener.endsWith("'")) {
listener = listener.substring(0, listener.length() - 1);
}
setEventListener(listener);
}
setEventListener(listener);
}
String log = ci.getProperty(SetTypes.LOG, null);
if (log != null) {
......
......@@ -203,7 +203,8 @@ public class CompareLike extends Condition {
String value = l.getString();
boolean result;
if (regexp) {
result = patternRegexp.matcher(value).matches();
// result = patternRegexp.matcher(value).matches();
result = patternRegexp.matcher(value).find();
} else {
result = compareAt(value, 0, 0, value.length());
}
......
......@@ -195,7 +195,7 @@ public class FullText implements Trigger {
stat.execute("CREATE TABLE IF NOT EXISTS "+SCHEMA+".ROWS(ID IDENTITY, HASH INT, INDEXID INT, KEY VARCHAR, UNIQUE(HASH, INDEXID, KEY))");
// 3391, 1484
// stat.execute("CREATE TABLE IF NOT EXISTS "+SCHEMA+".MAP(ROWID INT, WORDID INT, UNIQUE(ROWID, WORDID), UNIQUE(WORDID, ROWID))");
// stat.execute("CREATE TABLE IF NOT EXISTS "+SCHEMA+".MAP(ROWID INT, WORDID INT, UNIQUE(ROWID, WORDID), UNIQUE(WORDID, ROWID))");
// 3063, 1484
stat.execute("CREATE TABLE IF NOT EXISTS "+SCHEMA+".MAP(ROWID INT, WORDID INT, PRIMARY KEY(WORDID, ROWID))");
......
......@@ -153,10 +153,6 @@ public class ViewIndex extends BaseIndex {
if (first != null) {
Value v = first.getValue(i);
if (v != null) {
if(paramList.size() <= idx) {
int tst;
System.out.println("stop!");
}
Parameter param = (Parameter) paramList.get(idx++);
param.setValue(v);
}
......
......@@ -1183,7 +1183,7 @@ compare { {{ALL|ANY|SOME}(select)} | operand }
","
The right hand side of a condition.
When comparing with LIKE, the wildcards characters are _ (any one character) and % (any characters).
When comparing with REGEXP, regular expression matching is used. See Java String.matches for details.
When comparing with REGEXP, regular expression matching is used. See Java Matcher.find for details.
","
LIKE 'Jo%'
"
......
......@@ -20,6 +20,7 @@ import java.util.Locale;
import java.util.Properties;
import java.util.TimeZone;
import org.h2.api.DatabaseEventListener;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
import org.h2.message.TraceSystem;
......@@ -418,22 +419,23 @@ public class WebServer implements Service {
}
}
Connection getConnection(String driver, String url, String user, String password) throws Exception {
Connection getConnection(String driver, String url, String user, String password, DatabaseEventListener listener) throws Exception {
driver = driver.trim();
url = url.trim();
user = user.trim();
password = password.trim();
org.h2.Driver.load();
Properties p = new Properties();
p.setProperty("user", user.trim());
p.setProperty("password", password.trim());
if (url.startsWith("jdbc:h2:")) {
p.put("DATABASE_EVENT_LISTENER_OBJECT", listener);
}
// try {
// Driver dr = (Driver) urlClassLoader.loadClass(driver).newInstance();
// Properties p = new Properties();
// p.setProperty("user", user);
// p.setProperty("password", password);
// return dr.connect(url, p);
// } catch(ClassNotFoundException e2) {
// throw e2;
// }
return JdbcUtils.getConnection(driver, url, user, password);
return JdbcUtils.getConnection(driver, url, p);
}
void shutdown() {
......
......@@ -31,6 +31,7 @@ import java.util.Random;
import java.util.StringTokenizer;
import java.util.Map.Entry;
import org.h2.api.DatabaseEventListener;
import org.h2.bnf.Bnf;
import org.h2.message.TraceSystem;
import org.h2.tools.SimpleResultSet;
......@@ -43,7 +44,7 @@ import org.h2.util.ObjectArray;
import org.h2.util.ScriptReader;
import org.h2.util.StringUtils;
class WebThread extends Thread {
class WebThread extends Thread implements DatabaseEventListener {
private WebServer server;
private WebSession session;
private Properties attributes;
......@@ -53,6 +54,8 @@ class WebThread extends Thread {
private String ifModifiedSince;
private String mimeType;
private boolean cache;
private int listenerLastState;
private long listenerLastEvent;
// TODO web: support online data editing like http://numsum.com/
......@@ -800,7 +803,7 @@ class WebThread extends Thread {
session.put("url", url);
session.put("user", user);
try {
Connection conn = server.getConnection(driver, url, user, password);
Connection conn = server.getConnection(driver, url, user, password, this);
JdbcUtils.closeSilently(conn);
session.put("error", "${text.login.testSuccessful}");
return "index.jsp";
......@@ -824,7 +827,7 @@ class WebThread extends Thread {
String user = attributes.getProperty("user", "");
String password = attributes.getProperty("password", "");
try {
Connection conn = server.getConnection(driver, url, user, password);
Connection conn = server.getConnection(driver, url, user, password, this);
session.setConnection(conn);
session.put("url", url);
session.put("user", user);
......@@ -1563,4 +1566,57 @@ class WebThread extends Thread {
return session;
}
private void log(String s) {
int test;
System.out.println(s);
}
public void closingDatabase() {
log("Closing database");
}
public void diskSpaceIsLow(long stillAvailable) throws SQLException {
log("Disk space is low; still available: " + stillAvailable);
}
public void exceptionThrown(SQLException e, String sql) {
log("Exception: " + e.toString() + " SQL: " + sql);
}
public void init(String url) {
log("Init: " + url);
}
public void opened() {
log("Database was opened");
}
public void setProgress(int state, String name, int x, int max) {
if (state == listenerLastState) {
long time = System.currentTimeMillis();
if (listenerLastEvent + 500 < time) {
return;
}
listenerLastEvent = time;
} else {
listenerLastState = state;
}
switch(state) {
case DatabaseEventListener.STATE_BACKUP_FILE:
log("Backing up " + name + " " + (100L * max / x) + "%");
break;
case DatabaseEventListener.STATE_CREATE_INDEX:
log("Creating index " + name + " " + (100L * max / x) + "%");
break;
case DatabaseEventListener.STATE_RECOVER:
log("Recovering " + name + " " + (100L * max / x) + "%");
break;
case DatabaseEventListener.STATE_SCAN_FILE:
log("Scanning file " + name + " " + (100L * max / x) + "%");
break;
default:
log("Unknown state: " + state);
}
}
}
......@@ -132,7 +132,9 @@ public class FileUtils {
if (isInMemory(oldName)) {
MemoryFile f = getMemoryFile(oldName);
f.setName(newName);
MEMORY_FILES.put(newName, f);
synchronized (MEMORY_FILES) {
MEMORY_FILES.put(newName, f);
}
return;
}
File oldFile = new File(oldName);
......@@ -239,7 +241,9 @@ public class FileUtils {
public static void delete(String fileName) throws SQLException {
fileName = translateFileName(fileName);
if (isInMemory(fileName)) {
MEMORY_FILES.remove(fileName);
synchronized (MEMORY_FILES) {
MEMORY_FILES.remove(fileName);
}
return;
}
File file = new File(fileName);
......@@ -309,7 +313,9 @@ public class FileUtils {
public static void tryDelete(String fileName) {
fileName = translateFileName(fileName);
if (isInMemory(fileName)) {
MEMORY_FILES.remove(fileName);
synchronized (MEMORY_FILES) {
MEMORY_FILES.remove(fileName);
}
return;
}
trace("tryDelete", fileName, null);
......@@ -328,19 +334,23 @@ public class FileUtils {
public static boolean exists(String fileName) {
fileName = translateFileName(fileName);
if (isInMemory(fileName)) {
return MEMORY_FILES.get(fileName) != null;
synchronized (MEMORY_FILES) {
return MEMORY_FILES.get(fileName) != null;
}
}
return new File(fileName).exists();
}
public static MemoryFile getMemoryFile(String fileName) {
MemoryFile m = (MemoryFile) MEMORY_FILES.get(fileName);
if (m == null) {
boolean compress = fileName.startsWith(MEMORY_PREFIX_LZF);
m = new MemoryFile(fileName, compress);
MEMORY_FILES.put(fileName, m);
synchronized (MEMORY_FILES) {
MemoryFile m = (MemoryFile) MEMORY_FILES.get(fileName);
if (m == null) {
boolean compress = fileName.startsWith(MEMORY_PREFIX_LZF);
m = new MemoryFile(fileName, compress);
MEMORY_FILES.put(fileName, m);
}
return m;
}
return m;
}
public static long length(String fileName) {
......@@ -396,13 +406,15 @@ public class FileUtils {
public static String[] listFiles(String path) throws SQLException {
path = translateFileName(path);
if (isInMemory(path)) {
String[] list = new String[MEMORY_FILES.size()];
MemoryFile[] l = new MemoryFile[MEMORY_FILES.size()];
MEMORY_FILES.values().toArray(l);
for (int i = 0; i < list.length; i++) {
list[i] = l[i].getName();
synchronized (MEMORY_FILES) {
String[] list = new String[MEMORY_FILES.size()];
MemoryFile[] l = new MemoryFile[MEMORY_FILES.size()];
MEMORY_FILES.values().toArray(l);
for (int i = 0; i < list.length; i++) {
list[i] = l[i].getName();
}
return list;
}
return list;
}
File f = new File(path);
try {
......
......@@ -9,6 +9,7 @@ import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
//#ifdef JDK14
import javax.naming.Context;
......@@ -73,16 +74,25 @@ public class JdbcUtils {
//#endif
public static Connection getConnection(String driver, String url, String user, String password) throws SQLException {
Properties prop = new Properties();
prop.setProperty("user", user);
prop.setProperty("password", password);
return getConnection(driver, url, prop);
}
public static Connection getConnection(String driver, String url, Properties prop) throws SQLException {
if (!StringUtils.isNullOrEmpty(driver)) {
try {
Class d = ClassUtils.loadClass(driver);
if (java.sql.Driver.class.isAssignableFrom(d)) {
return DriverManager.getConnection(url, user, password);
return DriverManager.getConnection(url, prop);
} else if (javax.naming.Context.class.isAssignableFrom(d)) {
// JNDI context
try {
Context context = (Context) d.newInstance();
DataSource ds = (DataSource) context.lookup(url);
String user = prop.getProperty("user");
String password = prop.getProperty("password");
return ds.getConnection(user, password);
} catch (InstantiationException e) {
throw Message.convert(e);
......@@ -93,13 +103,13 @@ public class JdbcUtils {
}
} else {
// Don't know, but maybe it loaded a JDBC Driver
return DriverManager.getConnection(url, user, password);
return DriverManager.getConnection(url, prop);
}
} catch (ClassNotFoundException e) {
throw Message.getSQLException(ErrorCode.CLASS_NOT_FOUND_1, new String[]{driver}, e);
}
}
return DriverManager.getConnection(url, user, password);
return DriverManager.getConnection(url, prop);
}
}
......@@ -48,6 +48,7 @@ import org.h2.test.db.TestTwoPhaseCommit;
import org.h2.test.db.TestView;
import org.h2.test.jdbc.TestCancel;
import org.h2.test.jdbc.TestDataSource;
import org.h2.test.jdbc.TestDatabaseEventListener;
import org.h2.test.jdbc.TestManyJdbcObjects;
import org.h2.test.jdbc.TestMetaData;
import org.h2.test.jdbc.TestNativeSQL;
......@@ -143,82 +144,80 @@ java org.h2.test.TestAll timer
/*
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
INSERT INTO TEST VALUES(1, 'Hello');
INSERT INTO TEST VALUES(2, 'HelloHello');
SELECT * FROM TEST WHERE NAME REGEXP 'He';
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
at java.util.HashMap$ValueIterator.next(HashMap.java:871)
at java.util.AbstractCollection.toArray(AbstractCollection.java:176)
at org.h2.util.FileUtils.listFiles(FileUtils.java:395)
at org.h2.engine.Database.deleteOldTempFiles(Database.java:1055)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:853)
at org.h2.engine.Database.close(Database.java:814)
at org.h2.engine.Database.removeSession(Database.java:755)
at org.h2.engine.Session.close(Session.java:260)
at org.h2.engine.Database.close(Database.java:783)
SCRIPT: append ; also in result set (copy paste problem)
web page translation
Full Text Search
H2 supports Lucene full text search and native full text search implementation.
Using the Native Full Text Search
To initialize, call:
CREATE ALIAS IF NOT EXISTS FT_INIT FOR "org.h2.fulltext.FullText.init";
CALL FT_INIT();
Afterwards, you can create a full text index for a table using:
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello World');
CALL FT_CREATE_INDEX('PUBLIC', 'TEST', NULL);
where PUBLIC is the schema, TEST is the table name. The list of column names (column separated) is optional, in this case all columns are indexed. The index is updated in read time. To search the index, use the following query:
SELECT * FROM FT_SEARCH('Hello', 0, 0);
You can also call the index from within a Java application:
org.h2.fulltext.FullText.search(conn, text, limit, offset)
Using the Lucene Full Text Search
To use the Lucene full text search, you first need to rename the file FullTextLucene.java.txt to FullTestLucene.java and compile it. Also, you need the Lucene library in the classpath.
To initialize, call:
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init";
CALL FTL_INIT();
Afterwards, you can create a full text index for a table using:
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello World');
CALL FTL_CREATE_INDEX('PUBLIC', 'TEST', NULL);
where PUBLIC is the schema, TEST is the table name. The list of column names (column separated) is optional, in this case all columns are indexed. The index is updated in read time. To search the index, use the following query:
SELECT * FROM FTL_SEARCH('Hello', 0, 0);
You can also call the index from within a Java application:
org.h2.fulltext.FullTextLucene.search(conn, text, limit, offset)
create table test(id int, name varchar(255));
SELECT * FROM TEST a natural JOIN TEST b;
drop table test;
H2:
ID, NAME, ID, NAME
MySQL, PostgreSQL:
ID, NAME
Derby, HSQLDB, MS SQL Server:
no supported
H2 supports cancel for the embedded mode but not yet for the client / server mode. I will add a feature request for this.
set log 0;
create table test(id int primary key, name varchar);
@LOOP 10000 insert into test values(?, space(100000));
shutdown;
a SHUTDOWN command is not enough? >
No, currently SHUTDOWN will not correctly close the objects if LOG is set to 0.
It _should_ be enough however. I will change the code so that in the future SHUTDOWN will be enough, and regular database closing will be enough.
run benchmark with newest version of apache derby and hsqldb
java org.h2.tools.RunScript -url jdbc:h2:file:bug -user SA -script \temp\test\data.sql
data.sql, test.java
I have a big problem with PreparedStatements and version 2007-07-12 or above.
With 2007-04-29 or lower it works as expected.
In the test query i use a UNION ALL (i know, not well tested), but also with a simple SELECT/UPDATE/INSERT prepared statement with a where clause and parameters the problem happens, if i run the query more than once with different parameters. It always returns the result from the first executeQuery() or updates the rows return from the first query.
But the funny thing is, i cannot reproduce the bug with a simple SELECT in the test app.
If i run the test app, the output is with ver 2007-07-12:
Row Count 9
Sum 714.8621259
Row Count 9
Sum 714.8621259
Row Count 9
Sum 714.8621259
(looks like it takes every time the first result)
with ver 2007-04-29
Row Count 9
Sum 714.8621259
Row Count 7
Sum 0.0
Row Count 10
Sum 381.230477
drop table multi_pages;
drop table bib_holdings;
create table multi_pages(dir_num int, bh_id int);
insert into multi_pages values(1, 1);
insert into multi_pages values(2, 2);
insert into multi_pages values(3, 3);
create table bib_holdings(id int primary key, site varchar(255));
insert into bib_holdings values(1, 'WSTIAC');
insert into bib_holdings values(2, 'WSTIAC');
insert into bib_holdings values(3, 'WSTIAC');
select * from (select dir_num, count(*) as cnt
from multi_pages t, bib_holdings bh
where t.bh_id=bh.id and bh.site='WSTIAC' group by dir_num) as x
where cnt < 1000 order by dir_num asc;
explain select * from (select dir_num, count(*) as cnt
from multi_pages t, bib_holdings bh
where t.bh_id=bh.id and bh.site='WSTIAC' group by dir_num) as x
where cnt < 1000 order by dir_num asc;
select dir_num, count(*) as cnt
from multi_pages t, bib_holdings bh
where t.bh_id=bh.id and bh.site='WSTIAC'
group by dir_num
having count(*) < 1000
order by dir_num asc;
TestMultiThreadedKernel and integrate in unit tests; use also in-memory and so on
......@@ -624,6 +623,7 @@ TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER;
// jdbc
new TestCancel().runTest(this);
// new TestDatabaseEventListener().runTest(this);
new TestDataSource().runTest(this);
new TestManyJdbcObjects().runTest(this);
new TestMetaData().runTest(this);
......
......@@ -63,11 +63,11 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
rs = stat.executeQuery("SCRIPT");
checkRows(rs, new String[] {
"CREATE TRIGGER PUBLIC.INS_BEFORE BEFORE INSERT ON PUBLIC.TEST FOR EACH ROW NOWAIT CALL \""
+ getClass().getName() + "\"",
+ getClass().getName() + "\";",
"CREATE TRIGGER PUBLIC.INS_AFTER AFTER INSERT ON PUBLIC.TEST FOR EACH ROW NOWAIT CALL \""
+ getClass().getName() + "\"",
+ getClass().getName() + "\";",
"CREATE TRIGGER PUBLIC.UPD_BEFORE BEFORE UPDATE ON PUBLIC.TEST FOR EACH ROW NOWAIT CALL \""
+ getClass().getName() + "\"" });
+ getClass().getName() + "\";" });
while (rs.next()) {
String sql = rs.getString(1);
if (sql.startsWith("CREATE TRIGGER")) {
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
CREATE TABLE FOO (A CHAR(10));
> ok
CREATE TABLE BAR AS SELECT * FROM FOO;
> ok
select table_name, numeric_precision from information_schema.columns where column_name = 'A';
> TABLE_NAME NUMERIC_PRECISION
> ---------- -----------------
> BAR 10
> FOO 10
> rows: 2
DROP TABLE FOO, BAR;
> ok
create table multi_pages(dir_num int, bh_id int);
> ok
......@@ -848,22 +864,22 @@ insert into test values(1, 'abc' || space(20));
script nopasswords nosettings blocksize 10;
> SCRIPT
> ------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> CALL SYSTEM_COMBINE_BLOB(-1)
> CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR "org.h2.command.dml.ScriptCommand.combineBlob"
> CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR "org.h2.command.dml.ScriptCommand.combineClob"
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, DATA CLOB )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT, PART INT, CDATA VARCHAR, BDATA BINARY, PRIMARY KEY(ID, PART))
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> DROP ALIAS IF EXISTS SYSTEM_COMBINE_BLOB
> DROP ALIAS IF EXISTS SYSTEM_COMBINE_CLOB
> DROP TABLE IF EXISTS SYSTEM_LOB_STREAM
> INSERT INTO PUBLIC.TEST(ID, DATA) VALUES(1, SYSTEM_COMBINE_CLOB(0))
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 0, 'abc ', NULL);
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 1, ' ', NULL);
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 2, ' ', NULL);
> -------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CALL SYSTEM_COMBINE_BLOB(-1);
> CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR "org.h2.command.dml.ScriptCommand.combineBlob";
> CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR "org.h2.command.dml.ScriptCommand.combineClob";
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, DATA CLOB );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT, PART INT, CDATA VARCHAR, BDATA BINARY, PRIMARY KEY(ID, PART));
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP ALIAS IF EXISTS SYSTEM_COMBINE_BLOB;
> DROP ALIAS IF EXISTS SYSTEM_COMBINE_CLOB;
> DROP TABLE IF EXISTS SYSTEM_LOB_STREAM;
> INSERT INTO PUBLIC.TEST(ID, DATA) VALUES(1, SYSTEM_COMBINE_CLOB(0));
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 0, 'abc ', NULL);;
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 1, ' ', NULL);;
> INSERT INTO SYSTEM_LOB_STREAM VALUES(0, 2, ' ', NULL);;
> rows: 15
drop table test;
......@@ -1253,10 +1269,10 @@ insert into test values('AA');
script nodata nopasswords nosettings;
> SCRIPT
> ------------------------------------------------------------------------------
> -- 2 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( NAME VARCHAR CHECK (NAME = UPPER(NAME)) )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> -------------------------------------------------------------------------------
> -- 2 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( NAME VARCHAR CHECK (NAME = UPPER(NAME)) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 3
drop table test;
......@@ -1327,20 +1343,20 @@ select DOMAIN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, PRECISION, SCALE, TY
script nodata nopasswords nosettings;
> SCRIPT
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.ADDRESS
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE DOMAIN EMAIL AS VARCHAR(200) CHECK (POSITION('@', VALUE) > 1)
> CREATE DOMAIN GMAIL AS VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', VALUE) > 1) AND (POSITION('gmail', VALUE) > 1))
> CREATE DOMAIN STRING AS VARCHAR(255) DEFAULT '' NOT NULL
> CREATE DOMAIN STRING1 AS VARCHAR
> CREATE DOMAIN STRING2 AS VARCHAR NOT NULL
> CREATE DOMAIN STRING3 AS VARCHAR DEFAULT '<empty>'
> CREATE DOMAIN STRING_X AS VARCHAR DEFAULT '<empty>'
> CREATE MEMORY TABLE PUBLIC.ADDRESS( ID INT NOT NULL, NAME VARCHAR(200) CHECK (POSITION('@', NAME) > 1), NAME2 VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', NAME2) > 1) AND (POSITION('gmail', NAME2) > 1)) )
> CREATE MEMORY TABLE PUBLIC.TEST( A VARCHAR(255) DEFAULT '', B VARCHAR, C VARCHAR, D VARCHAR DEFAULT '<empty>' )
> CREATE PRIMARY KEY ON PUBLIC.ADDRESS(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.ADDRESS;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE DOMAIN EMAIL AS VARCHAR(200) CHECK (POSITION('@', VALUE) > 1);
> CREATE DOMAIN GMAIL AS VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', VALUE) > 1) AND (POSITION('gmail', VALUE) > 1));
> CREATE DOMAIN STRING AS VARCHAR(255) DEFAULT '' NOT NULL;
> CREATE DOMAIN STRING1 AS VARCHAR;
> CREATE DOMAIN STRING2 AS VARCHAR NOT NULL;
> CREATE DOMAIN STRING3 AS VARCHAR DEFAULT '<empty>';
> CREATE DOMAIN STRING_X AS VARCHAR DEFAULT '<empty>';
> CREATE MEMORY TABLE PUBLIC.ADDRESS( ID INT NOT NULL, NAME VARCHAR(200) CHECK (POSITION('@', NAME) > 1), NAME2 VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', NAME2) > 1) AND (POSITION('gmail', NAME2) > 1)) );
> CREATE MEMORY TABLE PUBLIC.TEST( A VARCHAR(255) DEFAULT '', B VARCHAR, C VARCHAR, D VARCHAR DEFAULT '<empty>' );
> CREATE PRIMARY KEY ON PUBLIC.ADDRESS(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 13
drop table test;
......@@ -1390,11 +1406,11 @@ create memory table a(k10 blob(10k), m20 blob(20m), g30 clob(30g));
script NODATA NOPASSWORDS NOSETTINGS drop;
> SCRIPT
> ------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A
> CREATE MEMORY TABLE PUBLIC.A( K10 BLOB(10240), M20 BLOB(20971520), G30 CLOB(32212254720) )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> DROP TABLE IF EXISTS PUBLIC.A
> -------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A;
> CREATE MEMORY TABLE PUBLIC.A( K10 BLOB(10240), M20 BLOB(20971520), G30 CLOB(32212254720) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP TABLE IF EXISTS PUBLIC.A;
> rows: 4
create table b();
......@@ -2387,27 +2403,27 @@ CREATE memory TABLE sp2(S_NO VARCHAR(5), p_no VARCHAR(5), qty INT, constraint c1
script NOPASSWORDS NOSETTINGS;
> SCRIPT
> -----------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.P
> -- 0 = SELECT COUNT(*) FROM PUBLIC.S
> -- 0 = SELECT COUNT(*) FROM PUBLIC.SP1
> -- 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.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
> 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 )
> CREATE MEMORY TABLE PUBLIC.SP2( S_NO VARCHAR(5) NOT NULL, P_NO VARCHAR(5) NOT NULL, QTY INT )
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, PARENT INT )
> CREATE PRIMARY KEY ON PUBLIC.P(P_NO)
> CREATE PRIMARY KEY ON PUBLIC.S(S_NO)
> CREATE PRIMARY KEY ON PUBLIC.SP1(S_NO, P_NO)
> CREATE PRIMARY KEY ON PUBLIC.SP2(S_NO, P_NO)
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> ------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.P;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.S;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.SP1;
> -- 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.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;
> 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 );
> CREATE MEMORY TABLE PUBLIC.SP2( S_NO VARCHAR(5) NOT NULL, P_NO VARCHAR(5) NOT NULL, QTY INT );
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, PARENT INT );
> CREATE PRIMARY KEY ON PUBLIC.P(P_NO);
> CREATE PRIMARY KEY ON PUBLIC.S(S_NO);
> CREATE PRIMARY KEY ON PUBLIC.SP1(S_NO, P_NO);
> CREATE PRIMARY KEY ON PUBLIC.SP2(S_NO, P_NO);
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 20
drop table test;
......@@ -2457,8 +2473,8 @@ drop table test;
script NOPASSWORDS NOSETTINGS drop;
> SCRIPT
> ----------------------------------------------
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> -----------------------------------------------
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 1
create local temporary table test1 (id identity);
......@@ -2685,17 +2701,17 @@ create trigger test_trigger before insert on s.test call "org.h2.test.db.TestTri
script NOPASSWORDS NOSETTINGS drop;
> SCRIPT
> --------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM S.TEST
> CREATE INDEX S.INDEX_ID ON S.TEST(ID)
> CREATE MEMORY TABLE S.TEST( ID INT )
> 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 USER IF NOT EXISTS SA PASSWORD '' ADMIN
> DROP SEQUENCE IF EXISTS S.SEQ
> DROP TABLE IF EXISTS S.TEST
> ---------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM S.TEST;
> CREATE INDEX S.INDEX_ID ON S.TEST(ID);
> CREATE MEMORY TABLE S.TEST( ID INT );
> 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 USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS S.SEQ;
> DROP TABLE IF EXISTS S.TEST;
> rows: 10
drop trigger s.test_trigger;
......@@ -2721,15 +2737,15 @@ alter table test alter column id rename to i;
script NOPASSWORDS NOSETTINGS drop;
> SCRIPT
> --------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.ABC FOREIGN KEY(I) REFERENCES PUBLIC.TEST(I) NOCHECK
> CREATE INDEX PUBLIC.IDX_N_ID ON PUBLIC.TEST(NAME, I)
> CREATE MEMORY TABLE PUBLIC.TEST( I INT NOT NULL, NAME VARCHAR(255), Y INT AS (I + 1) )
> CREATE PRIMARY KEY ON PUBLIC.TEST(I)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> DROP TABLE IF EXISTS PUBLIC.TEST
> INSERT INTO PUBLIC.TEST(I, NAME, Y) VALUES(1, 'Hello', 2)
> ---------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.ABC FOREIGN KEY(I) REFERENCES PUBLIC.TEST(I) NOCHECK;
> CREATE INDEX PUBLIC.IDX_N_ID ON PUBLIC.TEST(NAME, I);
> CREATE MEMORY TABLE PUBLIC.TEST( I INT NOT NULL, NAME VARCHAR(255), Y INT AS (I + 1) );
> CREATE PRIMARY KEY ON PUBLIC.TEST(I);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP TABLE IF EXISTS PUBLIC.TEST;
> INSERT INTO PUBLIC.TEST(I, NAME, Y) VALUES(1, 'Hello', 2);
> rows: 8
INSERT INTO TEST(i, name) VALUES(2, 'World');
......@@ -3069,14 +3085,14 @@ create sequence test_seq;
script NODATA NOPASSWORDS NOSETTINGS drop;
> SCRIPT
> -----------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, IM_IE VARCHAR(10) )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE SEQUENCE PUBLIC.TEST_SEQ START WITH 1
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> DROP SEQUENCE IF EXISTS PUBLIC.TEST_SEQ
> DROP TABLE IF EXISTS PUBLIC.TEST
> ------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, IM_IE VARCHAR(10) );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE SEQUENCE PUBLIC.TEST_SEQ START WITH 1;
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS PUBLIC.TEST_SEQ;
> DROP TABLE IF EXISTS PUBLIC.TEST;
> rows: 7
drop sequence test_seq;
......@@ -3757,14 +3773,14 @@ insert into test values(2, 'Cafe', X'cafe');
script nopasswords nosettings;
> SCRIPT
> ------------------------------------------------------------------------------
> -- 3 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, C CLOB, B BLOB )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(0, NULL, NULL)
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(1, '', X'')
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(2, 'Cafe', X'cafe')
> -------------------------------------------------------------------------------
> -- 3 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, C CLOB, B BLOB );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(0, NULL, NULL);
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(1, '', X'');
> INSERT INTO PUBLIC.TEST(ID, C, B) VALUES(2, 'Cafe', X'cafe');
> rows: 7
drop table test;
......@@ -4105,9 +4121,9 @@ SELECT MY_SQRT(-1.0) MS, SQRT(NULL) S;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ----------------------------------------------------
> CREATE FORCE ALIAS MY_SQRT FOR "java.lang.Math.sqrt"
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> -----------------------------------------------------
> CREATE FORCE ALIAS MY_SQRT FOR "java.lang.Math.sqrt";
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 2
SELECT ALIAS_NAME, JAVA_CLASS, JAVA_METHOD, DATA_TYPE, COLUMN_COUNT, RETURNS_RESULT, REMARKS FROM INFORMATION_SCHEMA.FUNCTION_ALIASES;
......@@ -4207,11 +4223,11 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY);
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> -------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 4
ALTER TABLE TEST ADD CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL;
......@@ -4291,19 +4307,19 @@ SELECT * FROM TEST_SEQ ORDER BY ID;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST_SEQ
> CREATE INDEX PUBLIC.IDXNAME ON PUBLIC.TEST(NAME)
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) DEFAULT 1, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP )
> CREATE MEMORY TABLE PUBLIC.TEST_SEQ( ID INT DEFAULT 20, DATA VARCHAR )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, NAME, CREATEDATE, MODIFY_DATE) VALUES(1, 'Hi', '2001-01-01', NULL)
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(-1, '-1')
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(1, '1')
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(10, '10')
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(20, '20')
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST_SEQ;
> CREATE INDEX PUBLIC.IDXNAME ON PUBLIC.TEST(NAME);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) DEFAULT 1, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
> CREATE MEMORY TABLE PUBLIC.TEST_SEQ( ID INT DEFAULT 20, DATA VARCHAR );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, NAME, CREATEDATE, MODIFY_DATE) VALUES(1, 'Hi', '2001-01-01', NULL);
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(-1, '-1');
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(1, '1');
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(10, '10');
> INSERT INTO PUBLIC.TEST_SEQ(ID, DATA) VALUES(20, '20');
> rows: 12
CREATE UNIQUE INDEX IDX_NAME_ID ON TEST(ID, NAME);
......@@ -4326,12 +4342,12 @@ DROP TABLE TEST_SEQ;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> --------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, CREATEDATE, MODIFY_DATE) VALUES(1, '2001-01-01', NULL)
> ---------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, CREATEDATE, MODIFY_DATE) VALUES(1, '2001-01-01', NULL);
> rows: 5
ALTER TABLE TEST ADD NAME VARCHAR(255) NULL BEFORE CREATEDATE;
......@@ -4339,12 +4355,12 @@ ALTER TABLE TEST ADD NAME VARCHAR(255) NULL BEFORE CREATEDATE;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255), CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, NAME, CREATEDATE, MODIFY_DATE) VALUES(1, NULL, '2001-01-01', NULL)
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255), CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, NAME, CREATEDATE, MODIFY_DATE) VALUES(1, NULL, '2001-01-01', NULL);
> rows: 5
UPDATE TEST SET NAME = 'Hi';
......@@ -4369,11 +4385,11 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> -------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 4
INSERT INTO TEST(ID, NAME) VALUES(1, 'Hi'), (2, 'World');
......@@ -5913,14 +5929,14 @@ CAST(XT AS TIMESTAMP) D2TS, CAST(XD AS TIMESTAMP) D2TS FROM TEST;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT, XT TIME, XD DATE, XTS TIMESTAMP )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(0, TIME '00:00:00', DATE '0001-02-03', TIMESTAMP '0002-03-04 00:00:00.0')
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(1, TIME '01:02:03', DATE '0004-05-06', TIMESTAMP '0007-08-09 00:01:02.0')
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(2, TIME '23:59:59', DATE '1999-12-31', TIMESTAMP '1999-12-31 23:59:59.123456789')
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(NULL, NULL, NULL, NULL)
> ----------------------------------------------------------------------------------------------------------------------------------
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT, XT TIME, XD DATE, XTS TIMESTAMP );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(0, TIME '00:00:00', DATE '0001-02-03', TIMESTAMP '0002-03-04 00:00:00.0');
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(1, TIME '01:02:03', DATE '0004-05-06', TIMESTAMP '0007-08-09 00:01:02.0');
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(2, TIME '23:59:59', DATE '1999-12-31', TIMESTAMP '1999-12-31 23:59:59.123456789');
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(NULL, NULL, NULL, NULL);
> rows: 7
DROP TABLE TEST;
......@@ -6795,14 +6811,14 @@ CREATE MEMORY TABLE CHILD(ID INT, PARENT_ID INT, FOREIGN KEY(PARENT_ID) REFERENC
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> -----------------------------------------------------------------------------------------------------------------------
> -- 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
> 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)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> ------------------------------------------------------------------------------------------------------------------------
> -- 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;
> 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);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 7
DROP TABLE PARENT;
......@@ -6855,11 +6871,11 @@ ALTER TABLE TEST ADD CONSTRAINT C1 FOREIGN KEY(A_INT) REFERENCES TEST(B_INT);
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ---------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.C1 FOREIGN KEY(A_INT) REFERENCES PUBLIC.TEST(B_INT) NOCHECK
> CREATE MEMORY TABLE PUBLIC.TEST( A_INT INT NOT NULL, B_INT INT NOT NULL )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> ----------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.C1 FOREIGN KEY(A_INT) REFERENCES PUBLIC.TEST(B_INT) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.TEST( A_INT INT NOT NULL, B_INT INT NOT NULL );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 4
ALTER TABLE TEST DROP CONSTRAINT C1;
......@@ -6999,21 +7015,21 @@ SELECT * FROM B_TEST;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A_TEST
> -- 1 = SELECT COUNT(*) FROM PUBLIC.B_TEST
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE UNIQUE(A_DATE)
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE_2 UNIQUE(A_DATE)
> 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
> 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)
> CREATE PRIMARY KEY ON PUBLIC.B_TEST(B_INT)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.B_TEST(B_INT, B_VARCHAR) VALUES(-1, 'XX')
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A_TEST;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.B_TEST;
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE UNIQUE(A_DATE);
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE_2 UNIQUE(A_DATE);
> 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;
> 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);
> CREATE PRIMARY KEY ON PUBLIC.B_TEST(B_INT);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.B_TEST(B_INT, B_VARCHAR) VALUES(-1, 'XX');
> rows: 14
DROP TABLE A_TEST;
......@@ -7100,24 +7116,24 @@ SELECT * FROM CHILD;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 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.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)
> CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENTID INT, FAMILY_ID INT, NAME VARCHAR(20) )
> CREATE MEMORY TABLE PUBLIC.FAMILY( ID INT, NAME VARCHAR(20) )
> CREATE MEMORY TABLE PUBLIC.PARENT( ID INT, FAMILY_ID INT, NAME VARCHAR(20) )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(100, 3, 1, 'Simon')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(101, 3, 1, 'Sabine')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(200, NULL, NULL, 'Jim')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(201, NULL, NULL, 'Johann')
> INSERT INTO PUBLIC.FAMILY(ID, NAME) VALUES(1, 'Capone')
> INSERT INTO PUBLIC.PARENT(ID, FAMILY_ID, NAME) VALUES(3, 1, 'Sue')
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 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.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);
> CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENTID INT, FAMILY_ID INT, NAME VARCHAR(20) );
> CREATE MEMORY TABLE PUBLIC.FAMILY( ID INT, NAME VARCHAR(20) );
> CREATE MEMORY TABLE PUBLIC.PARENT( ID INT, FAMILY_ID INT, NAME VARCHAR(20) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(100, 3, 1, 'Simon');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(101, 3, 1, 'Sabine');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(200, NULL, NULL, 'Jim');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(201, NULL, NULL, 'Johann');
> INSERT INTO PUBLIC.FAMILY(ID, NAME) VALUES(1, 'Capone');
> INSERT INTO PUBLIC.PARENT(ID, FAMILY_ID, NAME) VALUES(3, 1, 'Sue');
> rows: 17
ALTER TABLE CHILD DROP CONSTRAINT PARENT_CHILD;
......@@ -7125,23 +7141,23 @@ ALTER TABLE CHILD DROP CONSTRAINT PARENT_CHILD;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> -------------------------------------------------------------------------------------------------------------------------
> -- 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.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) )
> CREATE MEMORY TABLE PUBLIC.FAMILY( ID INT, NAME VARCHAR(20) )
> CREATE MEMORY TABLE PUBLIC.PARENT( ID INT, FAMILY_ID INT, NAME VARCHAR(20) )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(100, 3, 1, 'Simon')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(101, 3, 1, 'Sabine')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(200, NULL, NULL, 'Jim')
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(201, NULL, NULL, 'Johann')
> INSERT INTO PUBLIC.FAMILY(ID, NAME) VALUES(1, 'Capone')
> INSERT INTO PUBLIC.PARENT(ID, FAMILY_ID, NAME) VALUES(3, 1, 'Sue')
> --------------------------------------------------------------------------------------------------------------------------
> -- 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.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) );
> CREATE MEMORY TABLE PUBLIC.FAMILY( ID INT, NAME VARCHAR(20) );
> CREATE MEMORY TABLE PUBLIC.PARENT( ID INT, FAMILY_ID INT, NAME VARCHAR(20) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(100, 3, 1, 'Simon');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(101, 3, 1, 'Sabine');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(200, NULL, NULL, 'Jim');
> INSERT INTO PUBLIC.CHILD(ID, PARENTID, FAMILY_ID, NAME) VALUES(201, NULL, NULL, 'Johann');
> INSERT INTO PUBLIC.FAMILY(ID, NAME) VALUES(1, 'Capone');
> INSERT INTO PUBLIC.PARENT(ID, FAMILY_ID, NAME) VALUES(3, 1, 'Sue');
> rows: 16
DELETE FROM PARENT;
......@@ -7207,11 +7223,11 @@ CREATE MEMORY TABLE TEST(A INT, B INT, FOREIGN KEY (B) REFERENCES(A) ON UPDATE R
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
> CREATE MEMORY TABLE PUBLIC.TEST( A INT, B INT )
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> ------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_0 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
DROP TABLE TEST;
......@@ -7256,17 +7272,17 @@ ALTER INDEX IDX_ID RENAME TO IDX_ID2;
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> -----------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST2
> CREATE INDEX PUBLIC.IDX_ID2 ON PUBLIC.TEST2(ID)
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) )
> CREATE MEMORY TABLE PUBLIC.TEST2( ID INT )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> CREATE USER IF NOT EXISTS TEST PASSWORD ''
> CREATE USER IF NOT EXISTS TEST2 PASSWORD ''
> CREATE USER IF NOT EXISTS TEST_ADMIN PASSWORD '' ADMIN
> ------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST2;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE INDEX PUBLIC.IDX_ID2 ON PUBLIC.TEST2(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) );
> CREATE MEMORY TABLE PUBLIC.TEST2( ID INT );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> CREATE USER IF NOT EXISTS TEST PASSWORD '';
> CREATE USER IF NOT EXISTS TEST2 PASSWORD '';
> CREATE USER IF NOT EXISTS TEST_ADMIN PASSWORD '' ADMIN;
> rows: 10
SELECT NAME, ADMIN FROM INFORMATION_SCHEMA.USERS;
......@@ -7310,9 +7326,9 @@ ALTER USER SECURE SET SALT '112233' HASH '2233445566';
SCRIPT NOSETTINGS;
> SCRIPT
> ----------------------------------------------------------------
> CREATE USER IF NOT EXISTS SA SALT '' HASH '' ADMIN
> CREATE USER IF NOT EXISTS SECURE SALT '112233' HASH '2233445566'
> -----------------------------------------------------------------
> CREATE USER IF NOT EXISTS SA SALT '' HASH '' ADMIN;
> CREATE USER IF NOT EXISTS SECURE SALT '112233' HASH '2233445566';
> rows: 2
SET PASSWORD '123';
......@@ -7435,12 +7451,12 @@ INSERT INTO TEST VALUES(2, STRINGDECODE('abcsond\344rzeich\344 ') || char(22222)
script nopasswords nosettings;
> SCRIPT
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) )
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID)
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN
> INSERT INTO PUBLIC.TEST(ID, NAME) VALUES(2, STRINGDECODE('abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!'))
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) );
> CREATE PRIMARY KEY ON PUBLIC.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, NAME) VALUES(2, STRINGDECODE('abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!'));
> rows: 5
call STRINGENCODE(STRINGDECODE('abcsond\344rzeich\344 \u56ce \366\344\374\326\304\334\351\350\340\361!'));
......
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'HelloWorld'), (3, 'HelloWorldWorld');
SELECT COUNT(*) FROM TEST WHERE NAME REGEXP 'World';
> 2;
SELECT NAME FROM TEST WHERE NAME REGEXP 'WorldW';
> HelloWorldWorld;
drop table test;
select * from (select x from (select x from dual)) where 1=x;
> 1;
CREATE VIEW TEST_VIEW AS SELECT X FROM (SELECT X FROM DUAL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论