[teiid-commits] teiid SVN: r3413 - in trunk: client/src/main/java/org/teiid/jdbc and 23 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Aug 19 12:19:04 EDT 2011


Author: shawkins
Date: 2011-08-19 12:19:02 -0400 (Fri, 19 Aug 2011)
New Revision: 3413

Added:
   trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
Modified:
   trunk/build/kits/jboss-container/conf/jboss-teiid-log4j.xml
   trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
   trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
   trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
   trunk/common-core/src/main/java/org/teiid/core/util/ObjectConverterUtil.java
   trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/ProcedureExecutionParentImpl.java
   trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeEditor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
   trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
   trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
   trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
   trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
   trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
   trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
   trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
   trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
   trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java
   trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
   trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
   trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
   trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
Log:
forward merge of 7.5

Modified: trunk/build/kits/jboss-container/conf/jboss-teiid-log4j.xml
===================================================================
--- trunk/build/kits/jboss-container/conf/jboss-teiid-log4j.xml	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/build/kits/jboss-container/conf/jboss-teiid-log4j.xml	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1,3 +1,18 @@
+   
+   <!-- un-comment to enable Teiid COMMAND log, 
+        NOTE:  if there are categories above this appender, this will need to be moved above the categories
+				in order for this appender to work.
+   <appender name="COMMAND" class="org.jboss.logging.appender.RollingFileAppender">
+     <param name="File" value="${jboss.server.log.dir}/teiid-command.log"/>
+     <param name="MaxFileSize" value="1000KB"/>
+     <param name="MaxBackupIndex" value="25"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d %-5p [%c] (%t:%x) %m%n"/>
+      </layout>
+   </appender>   
+   -->
+   
+
 <!--
 	This file contains log4j.xml snippets that can be used in your main jboss-log4j.xml to control
 	Teiid logging in more depth.  By default all messages will go to the org.teiid category and 
@@ -5,14 +20,14 @@
 -->
 
    <!-- Teiid root category snippet.  Use this to control all of Teiid logging from a single category -->
-   <logger name="org.teiid">
-     <level value="INFO" />
-   </logger>
+   <category name="org.teiid">
+     <priority value="INFO" />
+   </category>
    
    <!--  this is to avoid the "Unable to remove nodes to reduce region size below 1024.  Set expiration for nodes in this region" error -->
-   <logger name="org.jboss.cache">
-     <level value="ERROR" />
-   </logger>  
+   <category name="org.jboss.cache">
+     <priority value="ERROR" />
+   </category>  
    
  <!-- Other categories:
 	org.teiid.PROCESSOR - Query processing logs. See also org.teiid.PLANNER for query planning logs.
@@ -49,27 +64,17 @@
  -->
    
    <!-- un-comment to enable COMMAND log - also needs the COMMAND appender to be uncommented
-   <logger name="org.teiid.COMMAND_LOG" additivity="false">
-      <level value="DEBUG"/>
+   <category name="org.teiid.COMMAND_LOG" additivity="false">
+      <priority value="DEBUG"/>
       <appender-ref ref="COMMAND"/>
-   </logger>
+   </category>
    -->
    
    <!-- Un-comment to enable AUDIT log - also needs the AUDIT appender to be uncommented.
    		JBoss already has an AUDIT appender, or you may create your own - see the COMMAND appender below
-   <logger name="org.teiid.AUDIT_LOG" additivity="false">
-      <level value="DEBUG"/>      
+   <category name="org.teiid.AUDIT_LOG" additivity="false">
+      <priority value="DEBUG"/>      
       <appender-ref ref="AUDIT"/>      
-   </logger>
+   </category>
    -->
-   
-   <!-- un-comment to enable Teiid COMMAND log
-   <appender name="COMMAND" class="org.jboss.logging.appender.RollingFileAppender">
-     <param name="File" value="${jboss.server.log.dir}/teiid-command.log"/>
-     <param name="MaxFileSize" value="1000KB"/>
-     <param name="MaxBackupIndex" value="25"/>
-      <layout class="org.apache.log4j.PatternLayout">
-         <param name="ConversionPattern" value="%d %-5p [%c] (%t:%x) %m%n"/>
-      </layout>
-   </appender>   
-   -->
+

Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -191,8 +191,8 @@
         throw new TeiidSQLException(msg);
     }
     
-    public ResultsFuture<Boolean> submitExecute() throws SQLException {
-        return executeSql(new String[] {this.prepareSql}, false, ResultsMode.EITHER, false);
+    public ResultsFuture<Boolean> submitExecute(ResultsMode mode) throws SQLException {
+        return executeSql(new String[] {this.prepareSql}, false, mode, false);
     }
 
 	@Override
@@ -236,14 +236,6 @@
     	return message;
     }
 
-    /**
-     * <p>Retreives a ResultSetMetaData object with information about the numbers,
-     * types, and properties of columns in the ResultSet object that will be returned
-     * when this preparedstatement object is executed.
-     * @return ResultSetMetaData object
-     * @throws SQLException, currently there is no means of getting results
-     * metadata before getting results.
-     */
     public ResultSetMetaData getMetaData() throws SQLException {
 
         // check if the statement is open

Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -245,6 +245,7 @@
     		public void onCompletion(ResultsFuture<ResultsMessage> future) {
     			try {
 					batchResults.setBatch(processBatch(future.get()));
+					result.getResultsReceiver().receiveResults(next());
 				} catch (Throwable t) {
 					result.getResultsReceiver().exceptionOccurred(t);
 				}
@@ -253,13 +254,6 @@
     	return result;
     }
 
-    /**
-     * Move row pointer forward one row.  This may cause the cursor
-     * to fetch more rows.
-     * @return True if the current index is on a valid row, false if
-     * the pointer is past the end of the rows
-     * @throws SQLException if this result set has an exception
-     */
     public boolean next() throws SQLException {
         checkClosed();
         if (hasNext()) {
@@ -269,24 +263,12 @@
     	return false;
     }
 
-    /**
-     * Move row pointer backward one row.  This may cause the cursor
-     * to fetch more rows.
-     * @return True if the current index is on a valid row, false if
-     * the pointer is before the beginning of the rows
-     * @throws SQLException if this result set has an exception
-     */
     public boolean previous() throws SQLException {
         checkClosed();
         checkNotForwardOnly();
         return batchResults.previous();
     }
 
-    /**
-     * Get current row pointer.
-     * @return Index of current row
-     * @throws SQLException if this result set has an exception
-     */
     public int getRow() throws SQLException {
         checkClosed();
         if (isAfterLast()) {

Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -423,7 +423,7 @@
         			JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
         		}
         		this.updateCounts = new int[] {0};
-        		return booleanFuture(true);
+        		return booleanFuture(false);
         	}
         	match = TRANSACTION_STATEMENT.matcher(commands[0]);
         	if (match.matches()) {

Modified: trunk/common-core/src/main/java/org/teiid/core/util/ObjectConverterUtil.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/ObjectConverterUtil.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/common-core/src/main/java/org/teiid/core/util/ObjectConverterUtil.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -118,6 +118,7 @@
 	        while ((l_nbytes = is.read(l_buffer, 0, readLength)) != -1) {
 	        	if (length != -1 && writen > length - l_nbytes) {
 		        	out.write(l_buffer, 0, writen + l_nbytes - length); 
+		        	writen = length;
 		        	break;
 	        	}
 	        	out.write(l_buffer,0,l_nbytes); 
@@ -143,7 +144,7 @@
     	return write(out, is, new byte[DEFAULT_READING_SIZE], length, close); // buffer holding bytes to be transferred
     }
     
-    public static void write(final Writer out, final Reader is, int length) throws IOException {
+    public static int write(final Writer out, final Reader is, int length, boolean close) throws IOException {
     	int writen = 0;
         try {
 	        char[] l_buffer = new char[DEFAULT_READING_SIZE]; // buffer holding bytes to be transferred
@@ -151,16 +152,20 @@
 	        while ((l_nbytes = is.read(l_buffer)) != -1) {
 	        	if (length != -1 && writen > length - l_nbytes) {
 		        	out.write(l_buffer, 0, writen + l_nbytes - length); 
+		        	writen = length;
 		        	break;
 	        	}
 	        	out.write(l_buffer,0,l_nbytes); 
 	        	writen += l_nbytes;
 	        }
+	        return writen;
         } finally {
-        	try {
-        		is.close();
-        	} finally {
-        		out.close();
+        	if (close) {
+	        	try {
+	        		is.close();
+	        	} finally {
+	        		out.close();
+	        	}
         	}
         }
     }
@@ -192,7 +197,7 @@
     public static void write(final Reader reader, final File f) throws IOException {
     	f.getParentFile().mkdirs();
     	FileWriter fw = new FileWriter(f);        
-        write(fw, reader, -1);   
+        write(fw, reader, -1, true);   
     }
 
     public static void write(final InputStream is, final File f) throws IOException {
@@ -290,7 +295,7 @@
 
     public static char[] convertToCharArray(Reader reader, int length) throws IOException {
         StringWriter sb = new StringWriter();     
-        write(sb, reader, length);
+        write(sb, reader, length, true);
         return sb.toString().toCharArray();
     }
 

Modified: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/ProcedureExecutionParentImpl.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/ProcedureExecutionParentImpl.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/ProcedureExecutionParentImpl.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -71,14 +71,18 @@
 
 	@Override
 	public void execute() throws TranslatorException {
-		if(getCommand().getProcedureName().endsWith("getUpdated")) {
+		String name = getCommand().getMetadataObject().getNameInSource();
+		if (name == null) {
+			name = getCommand().getProcedureName();
+		}
+		if("GetUpdated".equalsIgnoreCase(name)) { //$NON-NLS-1$
 			execution = new GetUpdatedExecutionImpl(this);
-			execution.execute(this);
-		}
-		else if(getCommand().getProcedureName().endsWith("getDeleted")) {
+		} else if("GetDeleted".equalsIgnoreCase(name)) { //$NON-NLS-1$
 			execution = new GetDeletedExecutionImpl(this);
-			execution.execute(this);
+		} else {
+			throw new AssertionError("Unknown procedure " + getCommand().getProcedureName() + " with name in source " + getCommand().getMetadataObject().getNameInSource()); //$NON-NLS-1$ //$NON-NLS-2$
 		}
+		execution.execute(this);
 	}
 
 	public void setCommand(Call command) {

Added: trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
===================================================================
--- trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java	                        (rev 0)
+++ trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.salesforce.execution;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Call;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
+
+ at SuppressWarnings("nls")
+public class TestProcedureExecution {
+	
+	private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
+
+	@Test public void testProcedureName() throws Exception {
+		Call command = (Call)translationUtility.parseCommand("exec getupdated('foo', {d '1970-01-01'}, {d '1990-01-01'})"); //$NON-NLS-1$
+		SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+		UpdatedResult ur = new UpdatedResult();
+		ur.setIDs(Arrays.asList("1", "2"));
+		Mockito.stub(sfc.getUpdated(Mockito.eq("foo"), (XMLGregorianCalendar)Mockito.anyObject(), (XMLGregorianCalendar)Mockito.anyObject())).toReturn(ur);
+		ProcedureExecutionParentImpl pepi = new ProcedureExecutionParentImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
+		pepi.execute();
+		assertNotNull(pepi.next());
+		assertNotNull(pepi.next());
+		assertNull(pepi.next());
+		pepi.close();
+	}
+	
+}


Property changes on: trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestProcedureExecution.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml	2011-08-19 16:19:02 UTC (rev 3413)
@@ -30,5 +30,10 @@
 			If a traditional join is not possible (such as with NOT IN) a merge join version of the semijoin or antijoin will be considered by upon the costing information available. 
 			</para>
 		</listitem>
+		<listitem>
+			<para><emphasis>org.teiid.ODBCPacketSize</emphasis> - defaults to 307200.  
+			Target size in bytes of the ODBC results buffer.  This is not a hard maximum, lobs and wide rows may use larger buffers.
+			</para>
+		</listitem>
 	</itemizedlist>
 </appendix>
\ No newline at end of file

Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml	2011-08-19 16:19:02 UTC (rev 3413)
@@ -203,21 +203,21 @@
                 Description = PostgreSQL Data Source
                 Servername = <Teiid Host name or ip>
                 Port = 35432 
-                Protocol = 7.4
+                Protocol = 7.4-1
                 UserName = <user-name> 
                 Password = <password>
                 Database = <vdb-name>
                 ReadOnly = no
                 ServerType = Postgres
                 ConnSettings = 
-                UseServerSidePrepare=0
+                UseServerSidePrepare=1
                 ByteaAsLongVarBinary=1
                 Optimizer=0
                 Ksqo=0
-                Trace = No
-                TraceFile = /var/log/trace.log
-                Debug = No
-                DebugFile = /var/log/debug.log                
+                Debug=0
+                Fetch = 10000
+                # enable below when dealing large resultsets
+                #UseDeclareFetch=1                
             ]]></programlisting>     
             
             <para>Note that you need "sudo" permissions to edit the "/etc/odbc.ini" file. 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -750,7 +750,9 @@
         }
         Set<CacheID> keys = this.matTables.replicatableKeys();
         for (final CacheID key:keys) {
-        	refreshMatView(contextProvider, key.getVDBKey().getName(), key.getVDBKey().getVersion(), key.getSql());
+        	if (key.getSql().startsWith(RelationalPlanner.MAT_PREFIX)) {
+        		refreshMatView(contextProvider, key.getVDBKey().getName(), key.getVDBKey().getVersion(), key.getSql().substring(RelationalPlanner.MAT_PREFIX.length()));
+        	}
         }
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -116,11 +116,9 @@
         
         TempTableStore tempTableStore = null;
         if(requestManager != null) {
-            if (workItem != null) {
-                ClientState state = requestManager.getClientState(workContext.getSessionId(), false);
-                if (state != null) {
-                	tempTableStore = state.sessionTables;
-                }
+            ClientState state = requestManager.getClientState(workContext.getSessionId(), false);
+            if (state != null) {
+            	tempTableStore = state.sessionTables;
             }
         }
         if(tempTableStore != null) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -38,6 +38,7 @@
 import org.teiid.cache.CacheConfiguration.Policy;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.Assertion;
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.logging.LogConstants;
@@ -238,6 +239,7 @@
 		}
 		
 		public CacheID(ParseInfo pi, String sql, String vdbName, int vdbVersion, String sessionId, String userName){
+			Assertion.isNotNull(sql);
 			this.sql = sql;
 			this.vdbInfo = new VDBKey(vdbName, vdbVersion);
 			this.pi = pi;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeEditor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeEditor.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeEditor.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -54,6 +54,9 @@
     }
 
 	public static final PlanNode findNodePreOrder(PlanNode root, int types, int stopTypes) {
+		if (root == null) {
+			return null;
+		}
 		if((types & root.getType()) == root.getType()) {
 			return root;
 		} else if((stopTypes & root.getType()) == root.getType()) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -223,7 +223,7 @@
         PlanNode sortNode = createSortNode(new ArrayList<SingleElementSymbol>(orderSymbols), outputSymbols);
         
         boolean distinct = false;
-        if (sourceNode.getType() == NodeConstants.Types.SOURCE && outputSymbols.size() == expressions.size() && outputSymbols.containsAll(expressions)) {
+        if (sourceNode.getFirstChild() != null && sourceNode.getType() == NodeConstants.Types.SOURCE && outputSymbols.size() == expressions.size() && outputSymbols.containsAll(expressions)) {
         	PlanNode setOp = NodeEditor.findNodePreOrder(sourceNode.getFirstChild(), NodeConstants.Types.SET_OP, NodeConstants.Types.SOURCE);
         	if (setOp != null) {
         		if (setOp.hasBooleanProperty(NodeConstants.Info.USE_ALL)) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -466,7 +466,9 @@
                 }
                 JoinType jt = (JoinType)root.getProperty(NodeConstants.Info.JOIN_TYPE);
                 
-                boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null || root.hasProperty(NodeConstants.Info.MAKE_DEP) || root.hasProperty(NodeConstants.Info.MAKE_IND);
+                boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null 
+                || root.hasProperty(NodeConstants.Info.MAKE_DEP) || root.hasProperty(NodeConstants.Info.MAKE_IND)
+                || !root.getExportedCorrelatedReferences().isEmpty();
                 
                 if (treatJoinAsSource) {
                     currentRegion.addJoinSourceNode(root);

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNodeUtil.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -108,6 +108,11 @@
                     }
                     return true;
                 }
+                
+                if (query.hasAggregates() && query.getGroupBy() == null) {
+                	return true;
+                }
+
                 break;
             case Command.TYPE_INSERT:
             	Insert insert = (Insert) command;

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -181,14 +181,16 @@
 					index = nameIndexes.get(col.getName());
 				}
 				if (index >= vals.size()) {
-					throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.no_value", col.getName(), textLine, systemId)); //$NON-NLS-1$
+					//throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.no_value", col.getName(), textLine, systemId)); //$NON-NLS-1$
+					tuple.add(null);
+				} else {
+					val = vals.get(index);
+					try {
+						tuple.add(DataTypeManager.transformValue(val, table.getColumns().get(output).getSymbol().getType()));
+					} catch (TransformationException e) {
+						throw new TeiidProcessingException(e, QueryPlugin.Util.getString("TextTableNode.conversion_error", col.getName(), textLine, systemId)); //$NON-NLS-1$
+					}
 				}
-				val = vals.get(index);
-				try {
-					tuple.add(DataTypeManager.transformValue(val, table.getColumns().get(output).getSymbol().getType()));
-				} catch (TransformationException e) {
-					throw new TeiidProcessingException(e, QueryPlugin.Util.getString("TextTableNode.conversion_error", col.getName(), textLine, systemId)); //$NON-NLS-1$
-				}
 			}
 			addBatchRow(tuple);
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -559,7 +559,7 @@
 			TupleSource ts = null;
 			CacheID cid = null;
 			if (distributedCache != null) {
-				cid = new CacheID(new ParseInfo(), viewName, context.getVdbName(), 
+				cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(), 
 						context.getVdbVersion(), context.getConnectionID(), context.getUserName());
 				if (useCache) {
 					CachedResults cr = this.distributedCache.get(cid);

Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1437,6 +1437,8 @@
 			if (item.getPrefix() != null) {
 				if (item.getPrefix().equals("xml") || item.getPrefix().equals("xmlns")) { //$NON-NLS-1$ //$NON-NLS-2$
 					handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.xml_namespaces_reserved"), obj); //$NON-NLS-1$
+				} else if (!Name11Checker.getInstance().isValidNCName(item.getPrefix())) {
+					handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.xml_namespaces_invalid", item.getPrefix()), obj); //$NON-NLS-1$
 				}
 				if (item.getUri().length() == 0) {
 					handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.xml_namespaces_null_uri"), obj); //$NON-NLS-1$

Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -90,6 +90,9 @@
 @SuppressWarnings("serial")
 public class SaxonXQueryExpression {
 	
+	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+	static final String DEFAULT_PREFIX = "-"; //$NON-NLS-1$
+
 	public static final Properties DEFAULT_OUTPUT_PROPERTIES = new Properties();
 	{
 		DEFAULT_OUTPUT_PROPERTIES.setProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
@@ -170,17 +173,17 @@
         this.xQueryString = xQueryString;
         StaticQueryContext context = new StaticQueryContext(config);
         IndependentContext ic = new IndependentContext(config);
-        namespaceMap.put("", ""); //$NON-NLS-1$ //$NON-NLS-2$
+        namespaceMap.put(EMPTY_STRING, EMPTY_STRING);
         if (namespaces != null) {
         	for (NamespaceItem item : namespaces.getNamespaceItems()) {
         		if (item.getPrefix() == null) {
         			if (item.getUri() == null) {
-        				context.setDefaultElementNamespace(""); //$NON-NLS-1$
-        				ic.setDefaultElementNamespace(""); //$NON-NLS-1$
+        				context.setDefaultElementNamespace(EMPTY_STRING); 
+        				ic.setDefaultElementNamespace(EMPTY_STRING);
         			} else {
         				context.setDefaultElementNamespace(item.getUri());
         				ic.setDefaultElementNamespace(item.getUri());
-        				namespaceMap.put("", item.getUri()); //$NON-NLS-1$
+        				namespaceMap.put(EMPTY_STRING, item.getUri());
         			}
         		} else {
     				context.declareNamespace(item.getPrefix(), item.getUri());
@@ -189,6 +192,7 @@
         		}
 			}
         }
+        namespaceMap.put(DEFAULT_PREFIX, namespaceMap.get(EMPTY_STRING));
         for (DerivedColumn derivedColumn : passing) {
         	if (derivedColumn.getAlias() == null) {
         		continue;

Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -82,7 +82,7 @@
 					"QName must not contain more than one colon: " //$NON-NLS-1$
 					+ "qname='" + localNames[i] + "', path='" + path + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 			if (k <= 0) {
-				fixedPath += " :"; //$NON-NLS-1$
+				fixedPath += SaxonXQueryExpression.DEFAULT_PREFIX+":"; //$NON-NLS-1$
 			} else {
 				String prefix = localNames[i].substring(0, k).trim();
 				if (k >= localNames[i].length() - 1)

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-08-19 16:19:02 UTC (rev 3413)
@@ -721,6 +721,7 @@
 ValidationVisitor.xml_namespaces=At most only one NO DEFAULT or DEFAULT namespace may be specified.
 ValidationVisitor.xml_namespaces_reserved=The namespaces xmlns and xml are reserved.
 ValidationVisitor.xml_namespaces_null_uri=The null uri, or empty string, is not allowed as the uri value.
+ValidationVisitor.xml_namespaces_invalid=The namespace prefix {0} is not a valid NCName
 ValidationVisitor.xml_attributes_reserved=The namespace xmlns is reserved.
 ValidationVisitor.xml_content_type=The expression "{0}" is of OBJECT or BLOB type, which cannot be used as an XML or TEXT content value.
 ValidationVisitor.xml_invalid_qname=The qname "{0}" is invalid.

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -474,5 +474,17 @@
 	public static BlobType blobFromFile(final String file) {
 		return new BlobType(new BlobImpl(new InputStreamFactory.FileInputStreamFactory(UnitTestUtil.getTestDataFile(file))));
 	}
+	
+    @Test public void testXmlTableWithDefault() throws Exception {
+        String sql = "select * from xmltable(XMLNAMESPACES(default 'http://x.y.com'), '/a/b' passing convert('<a xmlns=\"http://x.y.com\"><b>first</b><b x=\"attr\">second</b></a>', xml) columns x string path '@x', val string path '/.') as x"; //$NON-NLS-1$
+        
+        List<?>[] expected = new List<?>[] {
+        		Arrays.asList(null, "first"),
+        		Arrays.asList("attr", "second"),
+        };    
+    
+        process(sql, expected);
+    }
 
+
 }

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -22,6 +22,7 @@
 
 package org.teiid.query.processor;
 
+import static org.junit.Assert.*;
 import static org.teiid.query.optimizer.TestOptimizer.*;
 import static org.teiid.query.processor.TestProcessor.*;
 
@@ -43,6 +44,9 @@
 import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
 import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
+import org.teiid.query.processor.relational.JoinNode;
+import org.teiid.query.processor.relational.NestedTableJoinStrategy;
+import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.unittest.RealMetadataFactory;
 
 @SuppressWarnings({"unchecked", "nls"})
@@ -190,6 +194,17 @@
         process(sql, expected);
     }
 	
+	@Test public void testMissingValues() throws Exception {
+    	String sql = "select * from texttable('a,b\nc' COLUMNS c1 string, c2 string) x"; //$NON-NLS-1$
+    	
+        List[] expected = new List[] {
+        		Arrays.asList("a", "b"),
+        		Arrays.asList("c", null),
+        };
+        
+        process(sql, expected);
+    }
+	
 	@Test public void testQuote() throws Exception {
     	String sql = "select * from texttable('  \" a\", \" \"\" \"' COLUMNS c1 string, c2 string) x"; //$NON-NLS-1$
     	
@@ -266,8 +281,41 @@
         };    
 
         process(sql, expected);
-    }   
+    }
 	
+	@Test public void testTextTableJoin() throws Exception {
+		String sql = "select z.* from (select x.* from (select * from pm1.g1 where e1 = 'c') y, texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string) x) as z, " +
+				"(select x.* from (select * from pm1.g1 where e1 = 'c') y, texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string) x) as z1 where z.x = z1.x";
+    	
+        List[] expected = new List[] {
+        		Arrays.asList("c"),
+        		Arrays.asList("1"),
+        		Arrays.asList("true"),
+        };    
+
+        FakeDataManager dataManager = new FakeDataManager();
+        sampleData1(dataManager);
+        RelationalPlan plan = (RelationalPlan)helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
+        JoinNode join = (JoinNode) plan.getRootNode().getChildren()[0];
+        assertTrue(!(join.getJoinStrategy() instanceof NestedTableJoinStrategy));
+        helpProcess(plan, createCommandContext(), dataManager, expected);
+    } 
+	
+	@Test public void testTextTableJoin1() throws Exception {
+		String sql = "select e1, e2 from texttable('a' COLUMNS col string) x, pm1.g1 where col = e1";
+    	
+        List[] expected = new List[] {
+        		Arrays.asList("a", 0),
+        		Arrays.asList("a", 3),
+        		Arrays.asList("a", 0),
+        };    
+
+        FakeDataManager dataManager = new FakeDataManager();
+        sampleData1(dataManager);
+        RelationalPlan plan = (RelationalPlan)helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
+        helpProcess(plan, createCommandContext(), dataManager, expected);
+    } 
+	
 	public static void process(String sql, List[] expectedResults) throws Exception {    
     	FakeDataManager dataManager = new FakeDataManager();
         sampleData1(dataManager);

Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -124,4 +124,9 @@
         Query query = (Query)QueryParser.getQueryParser().parseCommand("SELECT e1, e2 FROM pm1.g1 LIMIT 0"); //$NON-NLS-1$
         assertFalse(RelationalNodeUtil.shouldExecute(query, false));
     }
+    
+    @Test public void testShouldExecuteAgg() throws Exception {
+        Query query = (Query)QueryParser.getQueryParser().parseCommand("SELECT count(*) FROM pm1.g1 where false"); //$NON-NLS-1$
+        assertTrue(RelationalNodeUtil.shouldExecute(query, false));
+    }
 }

Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1742,6 +1742,7 @@
     public static Procedure createStoredProcedure(String name, Schema model, List<ProcedureParameter> params) {
     	Procedure proc = new Procedure();
     	proc.setName(name);
+    	proc.setNameInSource(name);
     	if (params != null) {
     		int index = 1;
 	    	for (ProcedureParameter procedureParameter : params) {

Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1779,6 +1779,10 @@
     @Test public void testXMLNamespaces() {
     	helpValidate("select xmlforest(xmlnamespaces(no default, default 'http://foo'), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES(NO DEFAULT, DEFAULT 'http://foo')"}, RealMetadataFactory.example1Cached());
     }
+    
+    @Test public void testXMLNamespacesInvalid() {
+    	helpValidate("select xmlforest(xmlnamespaces('http://foo' as \"1\"), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES('http://foo' AS \"1\")"}, RealMetadataFactory.example1Cached());
+    }
 
     @Test public void testXMLNamespacesReserved() {
     	helpValidate("select xmlforest(xmlnamespaces('http://foo' as xmlns), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES('http://foo' AS xmlns)"}, RealMetadataFactory.example1Cached());

Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -326,7 +326,7 @@
 	}
 	
 	private String paramTable(String notIn) {
-		return "SELECT dt.oid as oid, pp.Position as position, pp.Type as type FROM ProcedureParams pp LEFT JOIN matpg_datatype dt ON pp.DataType=dt.Name " + //$NON-NLS-1$
+		return "SELECT case when pp.Type <> 'ResultSet' AND pp.DataType = 'object' then 2283 else dt.oid end as oid, pp.Position as position, pp.Type as type FROM ProcedureParams pp LEFT JOIN matpg_datatype dt ON pp.DataType=dt.Name " + //$NON-NLS-1$
 				"WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ("+notIn+")"; //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
@@ -386,79 +386,45 @@
 		
 		addColumn("typrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$ 
 		addColumn("typelem", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
-		
 		String transformation =
-			"SELECT 16 as oid,  'boolean' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			//"SELECT 17 as oid,  'blob' as typname,(SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			//"   union " + //$NON-NLS-1$
-			"SELECT 1043 as oid,  'string' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 25 as oid,  'text' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1042 as oid,  'char' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 21 as oid,  'short' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(2, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 20 as oid,  'long' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(8, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 23 as oid,  'integer' as typname,   (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(4, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 26 as oid,  'oid' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typname,    convert(4, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 700 as oid,  'float' as typname,(SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(4, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$ 
-			"   union " + //$NON-NLS-1$
-			"SELECT 701 as oid,  'double' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(8, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			//"SELECT 1009 as oid,  'clob' as typname,(SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			//"   union " + //$NON-NLS-1$
-			"SELECT 1082 as oid,  'date' as typname,  (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(4, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1083 as oid,  'datetime' as typname,(SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(8, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1114 as oid,  'timestamp' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(8, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1700 as oid,  'decimal' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X"  + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 142 as oid,  'xml' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 14939 as oid,  'lo' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X"+//$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 2278 as oid,  'void' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(4, short) as typlen,  convert('p', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 2249 as oid,  'record' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('p', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 0 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$		
-			"   union " + //$NON-NLS-1$
-			"SELECT 30 as oid,  'oidvector' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 26 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1000 as oid,  '_bool' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 16 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1002 as oid,  '_char' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 18 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1005 as oid,  '_int2' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 21 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1007 as oid,  '_int4' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 23 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1009 as oid,  '_text' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 25 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1028 as oid,  '_oid' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 26 as typelem  FROM (SELECT 1) X" + //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1014 as oid,  '_bpchar' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 1042 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1015 as oid,  '_varchar' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 1043 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1016 as oid,  '_int8' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 20 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1021 as oid,  '_float4' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 700 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1022 as oid,  '_float8' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 701 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1115 as oid,  '_timestamp' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 1114 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1182 as oid,  '_date' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 1082 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 1183 as oid,  '_time' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 1083 as typelem  FROM (SELECT 1) X"+ //$NON-NLS-1$
-			"   union " + //$NON-NLS-1$
-			"SELECT 2287 as oid,  '_record' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace,  convert(-1, short) as typlen,  convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid, 2249 as typelem  FROM (SELECT 1) X"; //$NON-NLS-1$
+			"select oid, typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, typlen, typtype, typbasetype, typtypmod, typrelid, typelem from texttable('" + //$NON-NLS-1$
+			"16,boolean,1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1043,string,-1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"25,text,-1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1042,char,1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"21,short,2,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"20,long,8,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"23,integer,4,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"26,oid,4,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"700,float,4,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"701,double,8,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"705,unknown,-2,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1082,date,4,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1083,datetime,8,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1114,timestamp,8,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"1700,decimal,-1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"142,xml,-1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"14939,lo,-1,b,0,-1,0,0\n" + //$NON-NLS-1$
+			"2278,void,4,p,0,-1,0,0\n" + //$NON-NLS-1$
+			"2249,record,-1,p,0,-1,0,0\n" + //$NON-NLS-1$
+			"30,oidvector,-1,b,0,-1,0,26\n" + //$NON-NLS-1$
+			"1000,_bool,-1,b,0,-1,0,16\n" + //$NON-NLS-1$
+			"1002,_char,-1,b,0,-1,0,18\n" + //$NON-NLS-1$
+			"1005,_int2,-1,b,0,-1,0,21\n" + //$NON-NLS-1$
+			"1007,_int4,-1,b,0,-1,0,23\n" + //$NON-NLS-1$
+			"1009,_text,-1,b,0,-1,0,25\n" + //$NON-NLS-1$
+			"1028,_oid,-1,b,0,-1,0,26\n" + //$NON-NLS-1$
+			"1014,_bpchar,-1,b,0,-1,0,1042\n" + //$NON-NLS-1$
+			"1015,_varchar,-1,b,0,-1,0,1043\n" + //$NON-NLS-1$
+			"1016,_int8,-1,b,0,-1,0,20\n" + //$NON-NLS-1$
+			"1021,_float4,-1,b,0,-1,0,700\n" + //$NON-NLS-1$
+			"1022,_float8,-1,b,0,-1,0,701\n" + //$NON-NLS-1$
+			"1115,_timestamp,-1,b,0,-1,0,1114\n" + //$NON-NLS-1$
+			"1182,_date,-1,b,0,-1,0,1082\n" + //$NON-NLS-1$
+			"1183,_time,-1,b,0,-1,0,1083\n" + //$NON-NLS-1$
+			"2287,_record,-1,b,0,-1,0,2249\n" + //$NON-NLS-1$
+			"2283,anyelement,4,p,0,-1,0,0" + //$NON-NLS-1$
+			"' columns oid integer, typname string, typlen short, typtype char, typbasetype integer, typtypmod integer, typrelid integer, typelem integer) AS t"; //$NON-NLS-1$
 		t.setSelectTransformation(transformation);			
 		return t;		
 	}
@@ -541,6 +507,7 @@
 		"WHEN (Name = 'time' ) THEN 'datetime' " + //$NON-NLS-1$
 		"WHEN (Name = 'biginteger' ) THEN 'decimal' " +//$NON-NLS-1$
 		"WHEN (Name = 'bigdecimal' ) THEN 'decimal' " +//$NON-NLS-1$
+		"WHEN (Name = 'object' ) THEN 'unknown' " +//$NON-NLS-1$
 		"ELSE Name END) as pg_name, Name, UID from SYS.DataTypes) as t ON t.pg_name = pt.typname";  //$NON-NLS-1$
 		t.setSelectTransformation(transformation);
 		t.setMaterialized(true);

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -302,9 +302,12 @@
 		if (target == null) {
 			throw new AdminProcessingException(RuntimePlugin.Util.getString("vdb_not_found", sourceVDBName, sourceVDBVersion)); //$NON-NLS-1$
 		}		
-		
+
+		notifyRemove(targetVDBName, targetVDBVersion);
 		// merge them
 		target.addChild(source);
+		
+		notifyAdd(targetVDBName, targetVDBVersion);
 	}
 	
 	// this is called by mc

Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -21,7 +21,6 @@
  */
 package org.teiid.odbc;
 
-import java.io.IOException;
 import java.sql.ParameterMetaData;
 import java.util.List;
 import java.util.Properties;
@@ -81,7 +80,7 @@
 	
 	void sendMoveCursor(ResultSetImpl rs, int rowCount, ResultsFuture<Integer> results);
 	
-	void sendCommandComplete(String sql, int updateCount) throws IOException;	
+	void sendCommandComplete(String sql, int updateCount);	
 
 	//	CommandComplete (B)
 	void sendUpdateCount(String sql, int updateCount);

Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -40,6 +40,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.teiid.client.RequestMessage.ResultsMode;
 import org.teiid.client.security.ILogon;
 import org.teiid.client.security.LogonException;
 import org.teiid.client.security.LogonResult;
@@ -245,121 +246,88 @@
 	}	
 	
 	private void cursorExecute(final String cursorName, final String sql, final ResultsFuture<Integer> completion) {
-		if (this.connection != null) {
-			if (sql != null) {
-				try {
-					// close if the name is already used or the unnamed prepare; otherwise
-					// stmt is alive until session ends.
-					Prepared previous = this.preparedMap.remove(cursorName);
-					if (previous != null) {
-						previous.stmt.close();
-					}
-					
-					final PreparedStatementImpl stmt = this.connection.prepareStatement(sql);
-	                this.executionFuture = stmt.submitExecute();
-	                this.executionFuture.addCompletionListener(new ResultsFuture.CompletionListener<Boolean>() {
-		        		@Override
-		        		public void onCompletion(ResultsFuture<Boolean> future) {
-		        			executionFuture = null;
-	                        try {
-				                if (future.get()) {
-				                	List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
-		                            cursorMap.put(cursorName, new Cursor(cursorName, sql, stmt, null, stmt.getResultSet(), cols));
-		        					client.sendCommandComplete("DECLARE CURSOR", 0); //$NON-NLS-1$		                            
-				                }
-				                else {
-				                	errorOccurred(RuntimePlugin.Util.getString("execution_failed")); //$NON-NLS-1$
-				                }
-	                        } catch (Throwable e) {
-	                            errorOccurred(e);
-	                        }
-			                completion.getResultsReceiver().receiveResults(1);			                	                        
-		        		}
-					});					
-				} catch (SQLException e) {
-					errorOccurred(e);
-					completion.getResultsReceiver().receiveResults(1);
-				} 
-			}
+		if (sql != null) {
+			try {
+				// close if the name is already used or the unnamed prepare; otherwise
+				// stmt is alive until session ends.
+				Prepared previous = this.preparedMap.remove(cursorName);
+				if (previous != null) {
+					previous.stmt.close();
+				}
+				
+				final PreparedStatementImpl stmt = this.connection.prepareStatement(sql);
+                this.executionFuture = stmt.submitExecute(ResultsMode.RESULTSET);
+                this.executionFuture.addCompletionListener(new ResultsFuture.CompletionListener<Boolean>() {
+	        		@Override
+	        		public void onCompletion(ResultsFuture<Boolean> future) {
+	        			executionFuture = null;
+                        try {
+		                	List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
+                            cursorMap.put(cursorName, new Cursor(cursorName, sql, stmt, null, stmt.getResultSet(), cols));
+        					client.sendCommandComplete("DECLARE CURSOR", 0); //$NON-NLS-1$		                            
+    						completion.getResultsReceiver().receiveResults(0);
+    					} catch (Throwable e) {
+    						completion.getResultsReceiver().exceptionOccurred(e);
+    					}
+	        		}
+				});					
+			} catch (SQLException e) {
+				completion.getResultsReceiver().exceptionOccurred(e);
+			} 
 		}
-		else {
-			errorOccurred(RuntimePlugin.Util.getString("no_active_connection")); //$NON-NLS-1$
-			completion.getResultsReceiver().receiveResults(1);
-		}
-		
 	}
 	
-	private void cursorFetch(String cursorName, int rows, final ResultsFuture<Integer> completion) {
+	private void cursorFetch(String cursorName, int rows, final ResultsFuture<Integer> completion) throws SQLException {
 		Cursor cursor = this.cursorMap.get(cursorName);
-		if (cursor != null) {
-			cursor.fetchSize = rows;
-			ResultsFuture<Integer> result = new ResultsFuture<Integer>();
-			this.client.sendCursorResults(cursor.rs, cursor.columnMetadata, result, rows);
-			result.addCompletionListener(new ResultsFuture.CompletionListener<Integer>() {
-            	public void onCompletion(ResultsFuture<Integer> future) {
-            		int rowsSent = 0;
-            		try {
-						rowsSent = future.get();
-						client.sendCommandComplete("FETCH", rowsSent); //$NON-NLS-1$						
-					} catch (InterruptedException e) {
-						throw new AssertionError(e);
-					} catch (ExecutionException e) {
-						errorOccurred(e.getCause());
-					} catch (IOException e) {
-						errorOccurred(e);
-					}
-					completion.getResultsReceiver().receiveResults(rowsSent);
-            	};
-			});
+		if (cursor == null) {
+			throw new SQLException(RuntimePlugin.Util.getString("not_bound", cursorName)); //$NON-NLS-1$
 		}
-		else {
-			errorOccurred(RuntimePlugin.Util.getString("not_bound", cursorName)); //$NON-NLS-1$
-			completion.getResultsReceiver().receiveResults(1);
-		}
+		cursor.fetchSize = rows;
+		ResultsFuture<Integer> result = new ResultsFuture<Integer>();
+		this.client.sendCursorResults(cursor.rs, cursor.columnMetadata, result, rows);
+		result.addCompletionListener(new ResultsFuture.CompletionListener<Integer>() {
+        	public void onCompletion(ResultsFuture<Integer> future) {
+        		try {
+					int rowsSent = future.get();
+					client.sendCommandComplete("FETCH", rowsSent); //$NON-NLS-1$						
+					completion.getResultsReceiver().receiveResults(rowsSent);
+				} catch (Throwable e) {
+					completion.getResultsReceiver().exceptionOccurred(e);
+				}
+        	};
+		});
 	}
 	
-	private void cursorMove(String prepareName, int rows, final ResultsFuture<Integer> completion) {
+	private void cursorMove(String prepareName, int rows, final ResultsFuture<Integer> completion) throws SQLException {
 		
 		// win odbc driver sending a move after close; and error is ending up in failure; since the below
 		// is not harmful it is ok to send empty move.
 		if (rows == 0) {
-			try {
-				client.sendCommandComplete("MOVE", 0); //$NON-NLS-1$
-			} catch (IOException e) {
-				errorOccurred(e);
-			}
+			client.sendCommandComplete("MOVE", 0); //$NON-NLS-1$
 			completion.getResultsReceiver().receiveResults(0);
 			return;			
 		}
 		
 		Cursor cursor = this.cursorMap.get(prepareName);
-		if (cursor != null) {
-			ResultsFuture<Integer> result = new ResultsFuture<Integer>();
-			this.client.sendMoveCursor(cursor.rs, rows, result);
-			result.addCompletionListener(new ResultsFuture.CompletionListener<Integer>() {
-            	public void onCompletion(ResultsFuture<Integer> future) {
-            		int rowsMoved = 0;
-            		try {
-						rowsMoved = future.get();
-						client.sendCommandComplete("MOVE", rowsMoved); //$NON-NLS-1$						
-					} catch (InterruptedException e) {
-						throw new AssertionError(e);
-					} catch (ExecutionException e) {
-						errorOccurred(e.getCause());
-					} catch (IOException e) {
-						errorOccurred(e);
-					}
-					completion.getResultsReceiver().receiveResults(rowsMoved);
-            	};
-			});			
+		if (cursor == null) {
+			throw new SQLException(RuntimePlugin.Util.getString("not_bound", prepareName)); //$NON-NLS-1$
 		}
-		else {
-			errorOccurred(RuntimePlugin.Util.getString("not_bound", prepareName)); //$NON-NLS-1$
-			completion.getResultsReceiver().receiveResults(1);
-		}
+		ResultsFuture<Integer> result = new ResultsFuture<Integer>();
+		this.client.sendMoveCursor(cursor.rs, rows, result);
+		result.addCompletionListener(new ResultsFuture.CompletionListener<Integer>() {
+        	public void onCompletion(ResultsFuture<Integer> future) {
+        		try {
+					int rowsMoved = future.get();
+					client.sendCommandComplete("MOVE", rowsMoved); //$NON-NLS-1$						
+					completion.getResultsReceiver().receiveResults(rowsMoved);
+				} catch (Throwable e) {
+					completion.getResultsReceiver().exceptionOccurred(e);
+				}
+        	};
+		});			
 	}	
 	
-	private void cursorClose(String prepareName) throws SQLException, IOException {
+	private void cursorClose(String prepareName) throws SQLException {
 		Cursor cursor = this.cursorMap.remove(prepareName);
 		if (cursor != null) {
 			cursor.rs.close();
@@ -379,15 +347,8 @@
     			try {
     				ResultsFuture<Integer> result = new ResultsFuture<Integer>();
 	                if (future.get()) {
-	                	if (stmt.getResultSet() != null) {
-	                		List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
-                            client.sendResults(sql, stmt.getResultSet(), cols, result, true);
-	                	}
-	                	else {
-	                		// handles the "SET" commands.
-		                	client.sendUpdateCount(sql, 0);
-		                	result.getResultsReceiver().receiveResults(1);
-	                	}					                	
+                		List<PgColInfo> cols = getPgColInfo(stmt.getResultSet().getMetaData());
+                        client.sendResults(sql, stmt.getResultSet(), cols, result, true);
 	                } else {
 	                	client.sendUpdateCount(sql, stmt.getUpdateCount());
 	                	setEncoding();
@@ -396,16 +357,20 @@
 	                result.addCompletionListener(new ResultsFuture.CompletionListener<Integer>() {
 	                	public void onCompletion(ResultsFuture<Integer> future) {
 							try {
-								stmt.close();
-							} catch (SQLException e) {
-								LogManager.logDetail(LogConstants.CTX_ODBC, e, "Error closing statement"); //$NON-NLS-1$
+		                		try {
+									stmt.close();
+								} catch (SQLException e) {
+									LogManager.logDetail(LogConstants.CTX_ODBC, e, "Error closing statement"); //$NON-NLS-1$
+								}
+								future.get();
+								completion.getResultsReceiver().receiveResults(1);
+							} catch (Throwable e) {
+								completion.getResultsReceiver().exceptionOccurred(e);
 							}
-							completion.getResultsReceiver().receiveResults(1);
 	                	}
 	                });
     			} catch (Throwable e) {
-    				errorOccurred(e);
-    				completion.getResultsReceiver().receiveResults(1);
+    				completion.getResultsReceiver().exceptionOccurred(e);
     			}
     		}
 		});    	
@@ -413,33 +378,27 @@
 	
 	@Override
 	public void prepare(String prepareName, String sql, int[] paramType) {
-		if (this.connection != null) {
-			
-			if (prepareName == null || prepareName.length() == 0) {
-				prepareName  = UNNAMED;
-			}
-						
-			if (sql != null) {
-				String modfiedSQL = fixSQL(sql);
-				try {
-					// close if the name is already used or the unnamed prepare; otherwise
-					// stmt is alive until session ends.
-					Prepared previous = this.preparedMap.remove(prepareName);
-					if (previous != null) {
-						previous.stmt.close();
-					}
+		if (prepareName == null || prepareName.length() == 0) {
+			prepareName  = UNNAMED;
+		}
 					
-					PreparedStatementImpl stmt = this.connection.prepareStatement(modfiedSQL);
-					this.preparedMap.put(prepareName, new Prepared(prepareName, sql, stmt, paramType));
-					this.client.prepareCompleted(prepareName);
-				} catch (SQLException e) {
-					errorOccurred(e);
+		if (sql != null) {
+			String modfiedSQL = fixSQL(sql);
+			try {
+				// close if the name is already used or the unnamed prepare; otherwise
+				// stmt is alive until session ends.
+				Prepared previous = this.preparedMap.remove(prepareName);
+				if (previous != null) {
+					previous.stmt.close();
 				}
+				
+				PreparedStatementImpl stmt = this.connection.prepareStatement(modfiedSQL);
+				this.preparedMap.put(prepareName, new Prepared(prepareName, sql, stmt, paramType));
+				this.client.prepareCompleted(prepareName);
+			} catch (SQLException e) {
+				errorOccurred(e);
 			}
 		}
-		else {
-			errorOccurred(RuntimePlugin.Util.getString("no_active_connection")); //$NON-NLS-1$
-		}
 	}	
 	
 	@Override
@@ -518,7 +477,7 @@
         		stmt.setMaxRows(maxRows);
         	}
         	
-            this.executionFuture = stmt.submitExecute();
+            this.executionFuture = stmt.submitExecute(ResultsMode.EITHER);
             executionFuture.addCompletionListener(new ResultsFuture.CompletionListener<Boolean>() {
         		@Override
         		public void onCompletion(ResultsFuture<Boolean> future) {
@@ -573,8 +532,6 @@
 					throw new AssertionError(e);
 				} catch (ExecutionException e) {
 					errorOccurred(e.getCause());
-				} catch (IOException e) {
-					errorOccurred(e);
 				}
 			};
 		});
@@ -936,7 +893,11 @@
 		    						client.errorOccurred(e);
 		    						return;
 		    					} catch (ExecutionException e) {
-		    						client.errorOccurred(e.getCause());
+		    						Throwable cause = e;
+		    						while (cause instanceof ExecutionException && cause.getCause() != null && cause != cause.getCause()) {
+		    							cause = cause.getCause();
+		    						}
+		    						client.errorOccurred(cause);
 		    						return;
 		    					}
 		            			QueryWorkItem.this.run(); //continue processing
@@ -996,6 +957,9 @@
     
 	private List<PgColInfo> getPgColInfo(ResultSetMetaData meta)
 			throws SQLException {
+		if (meta == null) {
+			return null;
+		}
 		int columns = meta.getColumnCount();
 		final ArrayList<PgColInfo> result = new ArrayList<PgColInfo>(columns);
 		for (int i = 1; i < columns + 1; i++) {

Modified: trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -21,6 +21,7 @@
  */
 package org.teiid.transport;
 
+import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -90,6 +91,7 @@
 
 	@Override
 	public void exceptionOccurred(Throwable t) {
+		LogManager.log(t instanceof IOException?MessageLevel.DETAIL:MessageLevel.ERROR, LogConstants.CTX_ODBC, t, "Unhandled exception, closing client instance"); //$NON-NLS-1$
 		server.terminate();
 	}
 	

Modified: trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -36,6 +36,7 @@
 
 public class ODBCSocketListener extends SocketListener {
 	private AuthenticationType authType = AuthenticationType.CLEARTEXT;
+	private int maxBufferSize = Integer.parseInt(System.getProperty("org.teiid.ODBCPacketSize", "307200")); //$NON-NLS-1$ //$NON-NLS-2$
 	private int maxLobSize;
 	private TeiidDriver driver;
 	private ILogon logonService;
@@ -59,6 +60,10 @@
 	public void setDriver(TeiidDriver driver) {
 		this.driver = driver;
 	}
+	
+	public void setMaxBufferSize(int maxBufferSize) {
+		this.maxBufferSize = maxBufferSize;
+	}
 
 	@Override
 	protected SSLAwareChannelHandler createChannelPipelineFactory(final SSLConfiguration config, final StorageManager storageManager) {
@@ -67,7 +72,7 @@
 				ChannelPipeline pipeline = new DefaultChannelPipeline();
 
 			    pipeline.addLast("odbcFrontendProtocol", new PgFrontendProtocol(1 << 20)); //$NON-NLS-1$
-			    pipeline.addLast("odbcBackendProtocol", new PgBackendProtocol(maxLobSize, config)); //$NON-NLS-1$
+			    pipeline.addLast("odbcBackendProtocol", new PgBackendProtocol(maxLobSize, maxBufferSize, config)); //$NON-NLS-1$
 			    pipeline.addLast("handler", this); //$NON-NLS-1$
 			    return pipeline;
 			}			

Modified: trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1,4 +1,3 @@
-
 /*
  * JBoss, Home of Professional Open Source.
  * See the COPYRIGHT.txt file distributed with this work for information
@@ -21,30 +20,13 @@
  * 02110-1301 USA.
  */package org.teiid.transport;
 
-import static org.teiid.odbc.PGUtil.PG_TYPE_BOOL;
-import static org.teiid.odbc.PGUtil.PG_TYPE_BPCHAR;
-import static org.teiid.odbc.PGUtil.PG_TYPE_BYTEA;
-import static org.teiid.odbc.PGUtil.PG_TYPE_CHARARRAY;
-import static org.teiid.odbc.PGUtil.PG_TYPE_DATE;
-import static org.teiid.odbc.PGUtil.PG_TYPE_FLOAT4;
-import static org.teiid.odbc.PGUtil.PG_TYPE_FLOAT8;
-import static org.teiid.odbc.PGUtil.PG_TYPE_INT2;
-import static org.teiid.odbc.PGUtil.PG_TYPE_INT4;
-import static org.teiid.odbc.PGUtil.PG_TYPE_INT8;
-import static org.teiid.odbc.PGUtil.PG_TYPE_NUMERIC;
-import static org.teiid.odbc.PGUtil.PG_TYPE_OIDARRAY;
-import static org.teiid.odbc.PGUtil.PG_TYPE_OIDVECTOR;
-import static org.teiid.odbc.PGUtil.PG_TYPE_TEXT;
-import static org.teiid.odbc.PGUtil.PG_TYPE_TEXTARRAY;
-import static org.teiid.odbc.PGUtil.PG_TYPE_TIME;
-import static org.teiid.odbc.PGUtil.PG_TYPE_TIMESTAMP_NO_TMZONE;
-import static org.teiid.odbc.PGUtil.PG_TYPE_UNKNOWN;
-import static org.teiid.odbc.PGUtil.PG_TYPE_VARCHAR;
+import static org.teiid.odbc.PGUtil.*;
 
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
 import java.io.StreamCorruptedException;
+import java.io.Writer;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.charset.Charset;
@@ -61,6 +43,7 @@
 import javax.net.ssl.SSLEngine;
 
 import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferOutputStream;
 import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.ChannelDownstreamHandler;
 import org.jboss.netty.channel.ChannelEvent;
@@ -72,7 +55,6 @@
 import org.jboss.netty.handler.ssl.SslHandler;
 import org.teiid.client.util.ResultsFuture;
 import org.teiid.core.util.ObjectConverterUtil;
-import org.teiid.core.util.ReaderInputStream;
 import org.teiid.core.util.ReflectionHelper;
 import org.teiid.jdbc.ResultSetImpl;
 import org.teiid.jdbc.TeiidSQLException;
@@ -108,9 +90,6 @@
 		}
 	}
 	
-    // 300k
-	static int ODBC_SOCKET_BUFF_SIZE = Integer.parseInt(System.getProperty("ODBCPacketSize", "307200"));
-	
 	private final class ResultsWorkItem implements Runnable {
 		private final List<PgColInfo> cols;
 		private final ResultSetImpl rs;
@@ -118,13 +97,14 @@
 		private int rows2Send;
 		private int rowsSent = 0;
 		private int rowsInBuffer = 0;
-		private ChannelBuffer buffer = ChannelBuffers.directBuffer(ODBC_SOCKET_BUFF_SIZE);
+		String sql;
 
 		private ResultsWorkItem(List<PgColInfo> cols, ResultSetImpl rs, ResultsFuture<Integer> result, int rows2Send) {
 			this.cols = cols;
 			this.rs = rs;
 			this.result = result;
 			this.rows2Send = rows2Send;
+			initBuffer(maxBufferSize / 8);
 		}
 
 		@Override
@@ -160,7 +140,7 @@
 			boolean processNext = true;
 			try {
     			if (future.get()) {
-    				sendDataRow(rs, cols, buffer);
+    				sendDataRow(rs, cols);
     				rowsSent++;
     				rowsInBuffer++;
     				boolean done = rowsSent == rows2Send;
@@ -170,7 +150,10 @@
     					result.getResultsReceiver().receiveResults(rowsSent);
     				}
     			} else {
-    				sendContents(buffer);
+    				sendContents();
+    				if (sql != null) {
+		    			sendCommandComplete(sql, 0);
+		    		}
     				result.getResultsReceiver().receiveResults(rowsSent);
     				processNext = false;
     			}
@@ -182,31 +165,33 @@
 		}
 		
 		private void flushResults(boolean force) {
-			int avgRowsize = buffer.readableBytes()/rowsInBuffer;
-			if (force || buffer.writableBytes() < (avgRowsize*2)) {
-				sendContents(buffer);
-				buffer= ChannelBuffers.directBuffer(ODBC_SOCKET_BUFF_SIZE);
+			int avgRowsize = dataOut.writerIndex()/rowsInBuffer;
+			if (force || (maxBufferSize - dataOut.writerIndex()) < (avgRowsize*2)) {
+				sendContents();
+				initBuffer(maxBufferSize / 8);
 				rowsInBuffer = 0;
 			}			
 		}
 	}
     
-    private DataOutputStream dataOut;
-    private ByteArrayOutputStream outBuffer;
-    private char messageType;
+    private ChannelBuffer dataOut;
+	private OutputStreamWriter writer;
+
     private Properties props;    
     private Charset encoding = Charset.forName("UTF-8");
     private ReflectionHelper clientProxy = new ReflectionHelper(ODBCClientRemote.class);
     private ChannelHandlerContext ctx;
     private MessageEvent message;
     private int maxLobSize = (2*1024*1024); // 2 MB
+	private final int maxBufferSize;
     
 	private volatile ResultsFuture<Boolean> nextFuture;
 
 	private SSLConfiguration config;
 
-	public PgBackendProtocol(int maxLobSize, SSLConfiguration config) {
+	public PgBackendProtocol(int maxLobSize, int maxBufferSize, SSLConfiguration config) {
     	this.maxLobSize = maxLobSize;
+    	this.maxBufferSize = maxBufferSize;
     	this.config = config;
     }
     
@@ -255,51 +240,39 @@
 	
 	@Override
 	public void useAuthenticationGSS() {
-		try {
-			sendAuthenticationGSS();
-		} catch (IOException e) {
-			terminate(e);
-		}		
+		sendAuthenticationGSS();
 	}
 	
 	@Override
 	public void authenticationGSSContinue(byte[] serviceToken) {
-		try {
-			sendAuthenticationGSSContinue(serviceToken);
-		} catch (IOException e) {
-			terminate(e);
-		}		
+		sendAuthenticationGSSContinue(serviceToken);
 	}
 	
 	@Override
 	public void authenticationSucess(int processId, int screctKey) {
-		try {
-			sendAuthenticationOk();
-			// server_version, server_encoding, client_encoding, application_name, 
-			// is_superuser, session_authorization, DateStyle, IntervalStyle, TimeZone, 
-			// integer_datetimes, and standard_conforming_strings. 
-			// (server_encoding, TimeZone, and integer_datetimes were not reported 
-			// by releases before 8.0; standard_conforming_strings was not reported by 
-			// releases before 8.1; IntervalStyle was not reported by releases before 8.4; 
-			// application_name was not reported by releases before 9.0.)
-			
-			sendParameterStatus("client_encoding", PGCharsetConverter.getEncoding(this.encoding));
-			sendParameterStatus("DateStyle", this.props.getProperty("DateStyle", "ISO"));
-			sendParameterStatus("integer_datetimes", "off");
-			sendParameterStatus("is_superuser", "off");
-			sendParameterStatus("server_encoding", "SQL_ASCII");
-			sendParameterStatus("server_version", "8.1.4");
-			sendParameterStatus("session_authorization", this.props.getProperty("user"));
-			sendParameterStatus("standard_conforming_strings", "off");
-			sendParameterStatus("application_name", this.props.getProperty("application_name", "ODBCClient"));
-			
-			// TODO PostgreSQL TimeZone
-			sendParameterStatus("TimeZone", "CET");
-			
-			sendBackendKeyData(processId, screctKey);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendAuthenticationOk();
+		// server_version, server_encoding, client_encoding, application_name, 
+		// is_superuser, session_authorization, DateStyle, IntervalStyle, TimeZone, 
+		// integer_datetimes, and standard_conforming_strings. 
+		// (server_encoding, TimeZone, and integer_datetimes were not reported 
+		// by releases before 8.0; standard_conforming_strings was not reported by 
+		// releases before 8.1; IntervalStyle was not reported by releases before 8.4; 
+		// application_name was not reported by releases before 9.0.)
+		
+		sendParameterStatus("client_encoding", PGCharsetConverter.getEncoding(this.encoding));
+		sendParameterStatus("DateStyle", this.props.getProperty("DateStyle", "ISO"));
+		sendParameterStatus("integer_datetimes", "off");
+		sendParameterStatus("is_superuser", "off");
+		sendParameterStatus("server_encoding", "SQL_ASCII");
+		sendParameterStatus("server_version", "8.1.4");
+		sendParameterStatus("session_authorization", this.props.getProperty("user"));
+		sendParameterStatus("standard_conforming_strings", "off");
+		sendParameterStatus("application_name", this.props.getProperty("application_name", "ODBCClient"));
+		
+		// TODO PostgreSQL TimeZone
+		sendParameterStatus("TimeZone", "CET");
+		
+		sendBackendKeyData(processId, screctKey);
 	}
 
 	@Override
@@ -314,29 +287,17 @@
 
 	@Override
 	public void errorOccurred(String msg) {
-		try {
-			sendErrorResponse(msg);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendErrorResponse(msg);
 	}
 
 	@Override
 	public void errorOccurred(Throwable t) {
-		try {
-			sendErrorResponse(t);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendErrorResponse(t);
 	}
 
 	@Override
 	public void ready(boolean inTransaction, boolean failedTransaction) {
-		try {
-			sendReadyForQuery(inTransaction, failedTransaction);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendReadyForQuery(inTransaction, failedTransaction);
 	}
 	
 	public void setEncoding(String value) {
@@ -349,47 +310,35 @@
 	@Override
 	public void sendParameterDescription(ParameterMetaData meta, int[] paramType) {
 		try {
-			try {
-				int count = meta.getParameterCount();
-				startMessage('t');
-				writeShort(count);
-				for (int i = 0; i < count; i++) {
-					int type;
-					if (paramType != null && paramType[i] != 0) {
-						type = paramType[i];
-					} else {
-						type = convertType(meta.getParameterType(i+1));
-					}
-					writeInt(type);
+			int count = meta.getParameterCount();
+			startMessage('t');
+			writeShort(count);
+			for (int i = 0; i < count; i++) {
+				int type;
+				if (paramType != null && paramType[i] != 0) {
+					type = paramType[i];
+				} else {
+					type = convertType(meta.getParameterType(i+1));
 				}
-				sendMessage();
-			} catch (SQLException e) {
-				sendErrorResponse(e);
-			}			
-		} catch (IOException e) {
-			terminate(e);
-		}
+				writeInt(type);
+			}
+			sendMessage();
+		} catch (SQLException e) {
+			sendErrorResponse(e);
+		}			
 	}
 
 	@Override
 	public void sendResultSetDescription(List<PgColInfo> cols) {
-		try {
-			sendRowDescription(cols);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendRowDescription(cols);
 	}
 	
 	@Override
 	public void sendCursorResults(ResultSetImpl rs, List<PgColInfo> cols, ResultsFuture<Integer> result, int rowCount) {
-		try {
-        	sendRowDescription(cols);
+    	sendRowDescription(cols);
 
-        	ResultsWorkItem r = new ResultsWorkItem(cols, rs, result, rowCount);
-        	r.run();  	        					
-		} catch (IOException e) {
-			terminate(e);
-		}
+    	ResultsWorkItem r = new ResultsWorkItem(cols, rs, result, rowCount);
+    	r.run();  	        					
 	}
 	
 	@Override
@@ -401,48 +350,36 @@
 	@Override
 	public void sendMoveCursor(ResultSetImpl rs, int rowCount, ResultsFuture<Integer> results) {
 		try {
-			try {
-				int rowsMoved = 0;
-				for (int i = 0; i < rowCount; i++) {
-					if (!rs.next()) {
-						break;
-					}
-					rowsMoved++;
-				}				
-				results.getResultsReceiver().receiveResults(rowsMoved);
-			} catch (SQLException e) {
-				sendErrorResponse(e);
-			}
-		} catch (IOException e) {
-			terminate(e);
+			int rowsMoved = 0;
+			for (int i = 0; i < rowCount; i++) {
+				if (!rs.next()) {
+					break;
+				}
+				rowsMoved++;
+			}				
+			results.getResultsReceiver().receiveResults(rowsMoved);
+		} catch (SQLException e) {
+			sendErrorResponse(e);
 		}
 	}		
 	
 	@Override
 	public void sendResults(final String sql, final ResultSetImpl rs, List<PgColInfo> cols, ResultsFuture<Integer> result, boolean describeRows) {
-		try {
-			if (nextFuture != null) {
-				sendErrorResponse(new IllegalStateException("Pending results have not been sent")); //$NON-NLS-1$
-			}
-        	
-        	if (describeRows) {
-        		sendRowDescription(cols);
-        	}
-        	ResultsWorkItem r = new ResultsWorkItem(cols, rs, result, -1);
-        	r.run();    
-        	sendCommandComplete(sql, 0);
-		} catch (IOException e) {
-			terminate(e);
+		if (nextFuture != null) {
+			sendErrorResponse(new IllegalStateException("Pending results have not been sent")); //$NON-NLS-1$
 		}
+    	
+    	if (describeRows) {
+    		sendRowDescription(cols);
+    	}
+    	ResultsWorkItem r = new ResultsWorkItem(cols, rs, result, -1);
+    	r.sql = sql;
+    	r.run();    
 	}
 
 	@Override
 	public void sendUpdateCount(String sql, int updateCount) {
-		try {
-			sendCommandComplete(sql, updateCount);
-		} catch (IOException e) {
-			terminate(e);
-		}
+		sendCommandComplete(sql, updateCount);
 	}
 
 	@Override
@@ -453,24 +390,16 @@
 
 	@Override
 	public void terminated() {
-		try {
-			trace("channel being terminated");
-			this.sendNoticeResponse("Connection closed");
-			this.ctx.getChannel().close();
-		} catch (IOException e) {
-			trace(e.getMessage());
-		}
+		trace("channel being terminated");
+		this.sendNoticeResponse("Connection closed");
+		this.ctx.getChannel().close();
 	}
 	
 	@Override
 	public void flush() {
-		try {
-			this.dataOut.flush();
-			this.dataOut = null;
-			Channels.write(this.ctx.getChannel(), null);
-		} catch (IOException e) {
-			terminate(e);
-		}		
+		this.dataOut = null;
+		this.writer = null;
+		Channels.write(this.ctx.getChannel(), null);
 	}
 
 	@Override
@@ -489,7 +418,7 @@
 	}
 
 	@Override
-	public void sendCommandComplete(String sql, int updateCount) throws IOException {
+	public void sendCommandComplete(String sql, int updateCount) {
 		startMessage('C');
 		sql = sql.trim().toUpperCase();
 		// TODO remove remarks at the beginning
@@ -526,32 +455,24 @@
 		sendMessage();
 	}
 
-	private void sendDataRow(ResultSet rs, List<PgColInfo> cols, ChannelBuffer buffer) throws SQLException, IOException {
-		startMessage('D');
+	private void sendDataRow(ResultSet rs, List<PgColInfo> cols) throws SQLException, IOException {
+		startMessage('D', -1);
+		int lengthIndex = this.dataOut.writerIndex() - 4;
 		writeShort(cols.size());
 		for (int i = 0; i < cols.size(); i++) {
-			byte[] bytes = getContent(rs, cols.get(i), i+1);			
-			if (bytes == null) {
-				writeInt(-1);
-			} else {
-				writeInt(bytes.length);
-				write(bytes);
+			int dataBytesIndex = this.dataOut.writerIndex();
+			writeInt(-1);
+			getContent(rs, cols.get(i), i+1);
+			writer.flush();
+			if (!rs.wasNull()) {
+				int bytes = this.dataOut.writerIndex() - dataBytesIndex - 4;
+				this.dataOut.setInt(dataBytesIndex, bytes);
 			}
 		}
-		
-		byte[] buff = outBuffer.toByteArray();
-		int len = buff.length;
-		this.outBuffer = null;
-		this.dataOut = null;
-		
-		// now build the wire contents.
-		buffer.writeByte((byte)this.messageType);
-		buffer.writeInt(len+4);
-		buffer.writeBytes(buff);
+		this.dataOut.setInt(lengthIndex, this.dataOut.writerIndex() - lengthIndex);
 	}
 	
-	private byte[] getContent(ResultSet rs, PgColInfo col, int column) throws SQLException, TeiidSQLException, IOException {
-		byte[] bytes = null;
+	private void getContent(ResultSet rs, PgColInfo col, int column) throws SQLException, TeiidSQLException, IOException {
 		switch (col.type) {
 			case PG_TYPE_BOOL:
 			case PG_TYPE_BPCHAR:
@@ -567,14 +488,19 @@
 		    case PG_TYPE_VARCHAR:
 		    	String value = rs.getString(column);
 		    	if (value != null) {
-		    		bytes = value.getBytes(this.encoding);
+			    	writer.write(value);
 		    	}
 		    	break;
 		    
 		    case PG_TYPE_TEXT:
 		    	Clob clob = rs.getClob(column);
 		    	if (clob != null) {
-		    		bytes = ObjectConverterUtil.convertToByteArray(new ReaderInputStream(clob.getCharacterStream(), this.encoding), this.maxLobSize);
+		    		Reader r = clob.getCharacterStream();
+		    		try {
+		    			ObjectConverterUtil.write(writer, r, this.maxLobSize, false);
+		    		} finally {
+		    			r.close();
+		    		}
 		    	}		        	
 		    	break;
 		    	
@@ -582,7 +508,8 @@
 		    	Blob blob = rs.getBlob(column);
 		    	if (blob != null) {
 		    		try {
-			    		bytes = PGbytea.toPGString(ObjectConverterUtil.convertToByteArray(blob.getBinaryStream(), this.maxLobSize)).getBytes(this.encoding);
+			    		String blobString = PGbytea.toPGString(ObjectConverterUtil.convertToByteArray(blob.getBinaryStream(), this.maxLobSize));
+			    		writer.write(blobString);
 		    		} catch(OutOfMemoryError e) {
 		    			throw new StreamCorruptedException("data too big: " + e.getMessage()); //$NON-NLS-1$ 
 		    		}
@@ -595,25 +522,25 @@
 		    	{
 		    	Object[] obj = (Object[])rs.getObject(column);
 		    	if (obj != null) {
-		    		StringBuilder sb = new StringBuilder();	
-			    	sb.append("{");
+		    		writer.append("{");
 			    	boolean first = true;
 			    	for (Object o:obj) {
 			    		if (!first) {
-			    			sb.append(",");
+			    			writer.append(",");
 			    		}
 			    		else {
 			    			first = false;
 			    		}
-			    		if (col.type == PG_TYPE_TEXTARRAY) {
-			    			escapeQuote(sb, o.toString());
+			    		if (o != null) {
+				    		if (col.type == PG_TYPE_TEXTARRAY) {
+				    			escapeQuote(writer, o.toString());
+				    		}
+				    		else {
+				    			writer.append(o.toString());
+				    		}
 			    		}
-			    		else {
-			    			sb.append(o.toString());
-			    		}
 			    	}
-			    	sb.append("}");
-			    	bytes = sb.toString().getBytes(this.encoding);
+			    	writer.append("}");
 		    	}
 		    	}
 		    	break;
@@ -622,18 +549,18 @@
 		    	{
 		    	Object[] obj = (Object[])rs.getObject(column);
 		    	if (obj != null) {
-		    		StringBuilder sb = new StringBuilder();	
 			    	boolean first = true;
 			    	for (Object o:obj) {
 			    		if (!first) {
-			    			sb.append(" ");
+			    			writer.append(" ");
 			    		}
 			    		else {
 			    			first = false;
 			    		}
-			    		sb.append(o);
+			    		if (o != null) {
+			    			writer.append(o.toString());
+			    		}
 			    	}
-			    	bytes = sb.toString().getBytes(this.encoding);
 		    	}	
 		    	}
 		    	break;
@@ -641,10 +568,9 @@
 		    default:
 		    	throw new TeiidSQLException("unknown datatype failed to convert"); 
 		}
-		return bytes;
 	}
 	
-	public static void escapeQuote(StringBuilder sb, String s) {
+	public static void escapeQuote(Writer sb, String s) throws IOException {
 		sb.append('"');
 		for (int i = 0; i < s.length(); i++) {
 			char c = s.charAt(i);
@@ -667,7 +593,7 @@
 		} catch (GeneralSecurityException e) {
 			LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.getString("PgBackendProtocol.ssl_error"));
 		}
-		ChannelBuffer buffer = ChannelBuffers.directBuffer(1);
+		ChannelBuffer buffer = ctx.getChannel().getConfig().getBufferFactory().getBuffer(1);
 		if (engine == null) {
 			buffer.writeByte('N');
 		} else {
@@ -677,7 +603,7 @@
 		Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());
 	}
 	
-	private void sendErrorResponse(Throwable t) throws IOException {
+	private void sendErrorResponse(Throwable t) {
 		trace(t.getMessage());
 		SQLException e = TeiidSQLException.create(t);
 		startMessage('E');
@@ -693,7 +619,13 @@
 		sendMessage();
 	}
 	
-	private void sendRowDescription(List<PgColInfo> cols) throws IOException {
+	private void sendRowDescription(List<PgColInfo> cols) {
+		if (cols == null) {
+			//send NoData
+			startMessage('n');
+			sendMessage();
+			return;
+		}
 		startMessage('T');
 		writeShort(cols.size());
 		for (PgColInfo info : cols) {
@@ -723,7 +655,7 @@
 		}
 	}
 
-	private void sendErrorResponse(String message) throws IOException {
+	private void sendErrorResponse(String message) {
 		trace("Exception:", message);
 		startMessage('E');
 		write('S');
@@ -736,7 +668,7 @@
 		sendMessage();
 	}
 	
-	private void sendNoticeResponse(String message) throws IOException {
+	private void sendNoticeResponse(String message) {
 		trace("notice:", message);
 		startMessage('N');
 		write('S');
@@ -768,26 +700,26 @@
 		sendMessage();
 	}
 	
-	private void sendAuthenticationGSS()  throws IOException {
+	private void sendAuthenticationGSS() {
 		startMessage('R');
 		writeInt(7);
 		sendMessage();
 	}
 	
-	private void sendAuthenticationGSSContinue(byte[] serviceToken) throws IOException  {
+	private void sendAuthenticationGSSContinue(byte[] serviceToken)  {
 		startMessage('R');
 		writeInt(8);
 		write(serviceToken);
 		sendMessage();
 	}	
 	
-	private void sendAuthenticationOk() throws IOException {
+	private void sendAuthenticationOk() {
 		startMessage('R');
 		writeInt(0);
 		sendMessage();
 	}
 
-	private void sendReadyForQuery(boolean inTransaction, boolean failedTransaction) throws IOException {
+	private void sendReadyForQuery(boolean inTransaction, boolean failedTransaction) {
 		startMessage('Z');
 		char c;
 		if (failedTransaction) {
@@ -807,14 +739,14 @@
 		sendMessage();
 	}
 
-	private void sendBackendKeyData(int processId, int screctKey) throws IOException {
+	private void sendBackendKeyData(int processId, int screctKey) {
 		startMessage('K');
 		writeInt(processId);
 		writeInt(screctKey);
 		sendMessage();
 	}
 
-	private void sendParameterStatus(String param, String value)	throws IOException {
+	private void sendParameterStatus(String param, String value) {
 		startMessage('S');
 		writeString(param);
 		writeString(value);
@@ -823,76 +755,75 @@
 	
 	@Override
 	public void functionCallResponse(byte[] data) {
-		try {
-			startMessage('V');
-			if (data == null) {
-				writeInt(-1);
-			}
-			else {
-				writeInt(data.length);
-				write(data);
-			}
-			sendMessage();
-		} catch (IOException e) {
-			terminate(e);
-		}		
+		startMessage('V');
+		if (data == null) {
+			writeInt(-1);
+		}
+		else {
+			writeInt(data.length);
+			write(data);
+		}
+		sendMessage();
 	}
 	
 	@Override
 	public void functionCallResponse(int data) {
-		try {
-			startMessage('V');
-			writeInt(4);
-			writeInt(data);
-			sendMessage();
-		} catch (IOException e) {
-			terminate(e);
-		}		
+		startMessage('V');
+		writeInt(4);
+		writeInt(data);
+		sendMessage();
 	}
 
-	private void writeString(String s) throws IOException {
+	private void writeString(String s) {
 		write(s.getBytes(this.encoding));
 		write(0);
 	}
 
-	private void writeInt(int i) throws IOException {
+	private void writeInt(int i) {
 		dataOut.writeInt(i);
 	}
 
-	private void writeShort(int i) throws IOException {
+	private void writeShort(int i) {
 		dataOut.writeShort(i);
 	}
 
-	private void write(byte[] data) throws IOException {
-		dataOut.write(data);
+	private void write(byte[] data) {
+		dataOut.writeBytes(data);
 	}
 
-	private void write(int b) throws IOException {
-		dataOut.write(b);
+	private void write(int b) {
+		dataOut.writeByte(b);
 	}
 
 	private void startMessage(char newMessageType) {
-		this.messageType = newMessageType;
-		this.outBuffer = new ByteArrayOutputStream();
-		this.dataOut = new DataOutputStream(this.outBuffer);
+		startMessage(newMessageType, 32);
 	}
 
+	private void startMessage(char newMessageType, int estimatedLength) {
+		if (estimatedLength > -1) {
+			initBuffer(estimatedLength);
+		}
+		this.dataOut.writeByte((byte)newMessageType);
+		this.dataOut.writerIndex(this.dataOut.writerIndex() + 4);
+	}
+
+	private void initBuffer(int estimatedLength) {
+		this.dataOut = ChannelBuffers.dynamicBuffer(estimatedLength);
+		ChannelBufferOutputStream cbos = new ChannelBufferOutputStream(this.dataOut);
+		this.writer = new OutputStreamWriter(cbos, this.encoding);
+	}
+
 	private void sendMessage() {
-		byte[] buff = outBuffer.toByteArray();
-		int len = buff.length;
-		this.outBuffer = null;
-		this.dataOut = null;
-		
-		// now build the wire contents.
-		ChannelBuffer buffer = ChannelBuffers.directBuffer(len+5);
-		buffer.writeByte((byte)this.messageType);
-		buffer.writeInt(len+4);
-		buffer.writeBytes(buff);
-		Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());
+		int pos = this.dataOut.writerIndex();
+		this.dataOut.setInt(1, pos - 1);
+		sendContents();
 	}
 	
-	private void sendContents(ChannelBuffer buffer) {
-		Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());
+	private void sendContents() {
+		ChannelBuffer cb = this.dataOut;
+		this.dataOut = null;
+		this.writer = null;
+		Channels.write(this.ctx, this.message.getFuture(), cb, this.message.getRemoteAddress());
 	}
 
 	private static void trace(String... msg) {

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-08-19 16:19:02 UTC (rev 3413)
@@ -82,7 +82,6 @@
 name_not_found=Translator property "name" not defined for the deployment "{0}"
 translator_type_not_found=The parent translator defined not found in configuration "{0}"
 failed_to_load_odbc_metadata=Failed to load the ODBC metadata repository.
-no_active_connection=No active connection found
 bad_binding=Binding on a statement, that has not been prepared:{0}
 not_bound=No bound statement found with name {0}
 no_stmt_found=No prepared statement found with name {0}
@@ -92,7 +91,6 @@
 ambigious_name=Ambiguous VDB name specified. Only single occurrence of the "." is allowed in the VDB name. Also, when version based vdb name is specified, then a separate "version" connection option is not allowed:{0}.{1} 
 lo_not_supported=LO functions are not supported
 SSLConfiguration.no_anonymous=The anonymous cipher suite TLS_DH_anon_WITH_AES_128_CBC_SHA is not available.  Please change the transport to be non-SSL or use non-anonymous SSL.
-execution_failed=Cursor execution failed
 
 PgBackendProtocol.ssl_error=Could not initialize ODBC SSL.  non-SSL connections will still be allowed.
 wrong_logon_type_jaas = Wrong logon method is being used. Server is not set up for JAAS based authentication. Correct your client's 'AuthenticationType' property.

Modified: trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java	2011-08-19 16:19:02 UTC (rev 3413)
@@ -130,7 +130,7 @@
 			config.setBindAddress(addr.getHostName());
 			config.setPortNumber(0);
 			odbcTransport = new ODBCSocketListener(config, BufferManagerFactory.getStandaloneBufferManager(), 0, 100000, Mockito.mock(ILogon.class));
-			
+			odbcTransport.setMaxBufferSize(1000); //set to a small size to ensure buffering over the limit works
 			FakeServer server = new FakeServer();
 			server.setUseCallingThread(false);
 			server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
@@ -181,6 +181,18 @@
 		TestMMDatabaseMetaData.compareResultSet(s.getResultSet());
 	}
 	
+	@Test public void testMultibatchSelect() throws Exception {
+		Statement s = conn.createStatement();
+		assertTrue(s.execute("select * from tables, columns"));
+		ResultSet rs = s.getResultSet();
+		int i = 0;
+		while (rs.next()) {
+			i++;
+			rs.getString(1);
+		}
+		assertEquals(7812, i);
+	}
+	
 	@Test public void testBlob() throws Exception {
 		Statement s = conn.createStatement();
 		assertTrue(s.execute("select to_bytes('abc', 'UTF-16')"));
@@ -199,6 +211,16 @@
 		String clob = rs.getString(1);
 		assertEquals("abc", clob);
 	}
+	
+	@Test public void testLargeClob() throws Exception {
+		Statement s = conn.createStatement();
+		assertTrue(s.execute("select cast(repeat('_', 3000) as clob)"));
+		ResultSet rs = s.getResultSet();
+		assertTrue(rs.next());
+		//getting as a clob is unsupported, since it uses the lo logic
+		String clob = rs.getString(1);
+		assertEquals(3000, clob.length());
+	}
 
 	@Test public void testTransactionCycle() throws Exception {
 		//TODO: drill in to ensure that the underlying statement has been set to autocommit false
@@ -276,6 +298,14 @@
 		rs.next();
 	}
 	
+	@Test public void testPreparedUpdate() throws Exception {
+		Statement stmt = conn.createStatement();
+		assertFalse(stmt.execute("create local temporary table x (y string)"));
+		PreparedStatement ps = conn.prepareStatement("delete from x");
+		assertFalse(ps.execute());
+		assertNull(ps.getMetaData());
+	}
+	
 	@Test public void testSelectSsl() throws Exception {
 		conn.close();
 		Driver d = new Driver();

Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected	2011-08-19 16:19:02 UTC (rev 3413)
@@ -209,10 +209,10 @@
 207          25           proretset                                                          16           1       3       4            false       false         false    
 208          25           prorettype                                                         23           4       4       4            false       false         false    
 209          25           pronargs                                                           21           2       5       4            false       false         false    
-210          25           proargtypes                                                        <null>       <null>  6       4            false       false         false    
-211          25           proargnames                                                        <null>       <null>  7       4            false       false         false    
-212          25           proargmodes                                                        <null>       <null>  8       4            false       false         false    
-213          25           proallargtypes                                                     <null>       <null>  9       4            false       false         false    
+210          25           proargtypes                                                        705          -2      6       4            false       false         false    
+211          25           proargnames                                                        705          -2      7       4            false       false         false    
+212          25           proargmodes                                                        705          -2      8       4            false       false         false    
+213          25           proallargtypes                                                     705          -2      9       4            false       false         false    
 214          25           pronamespace                                                       23           4       10      4            false       false         false    
 215          26           oid                                                                23           4       1       4            false       false         false    
 216          26           tgconstrrelid                                                      23           4       2       4            false       false         false    
@@ -232,8 +232,8 @@
 230          28           encoding                                                           23           4       3       4            false       false         false    
 231          28           datlastsysoid                                                      23           4       4       4            false       false         false    
 232          28           datallowconn                                                       1042         1       5       4            false       false         false    
-233          28           datconfig                                                          <null>       <null>  6       4            false       false         false    
-234          28           datacl                                                             <null>       <null>  7       4            false       false         false    
+233          28           datconfig                                                          705          -2      6       4            false       false         false    
+234          28           datacl                                                             705          -2      7       4            false       false         false    
 235          28           datdba                                                             23           4       8       4            false       false         false    
 236          28           dattablespace                                                      23           4       9       4            false       false         false    
 237          29           oid                                                                23           4       1       4            false       false         false    

Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected	2011-08-19 15:48:03 UTC (rev 3412)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected	2011-08-19 16:19:02 UTC (rev 3413)
@@ -1,40 +1,42 @@
 integer      string                                                             integer       short   char     integer      integer      integer      integer    
 oid          typname                                                            typnamespace  typlen  typtype  typbasetype  typtypmod    typrelid     typelem    
 16           boolean                                                            3             1       b        0            -1           0            0          
+1043         string                                                             3             -1      b        0            -1           0            0          
+25           text                                                               3             -1      b        0            -1           0            0          
+1042         char                                                               3             1       b        0            -1           0            0          
+21           short                                                              3             2       b        0            -1           0            0          
 20           long                                                               3             8       b        0            -1           0            0          
-21           short                                                              3             2       b        0            -1           0            0          
 23           integer                                                            3             4       b        0            -1           0            0          
-25           text                                                               3             -1      b        0            -1           0            0          
 26           oid                                                                3             4       b        0            -1           0            0          
-30           oidvector                                                          3             -1      b        0            -1           0            26         
-142          xml                                                                3             -1      b        0            -1           0            0          
 700          float                                                              3             4       b        0            -1           0            0          
 701          double                                                             3             8       b        0            -1           0            0          
+705          unknown                                                            3             -2      b        0            -1           0            0          
+1082         date                                                               3             4       b        0            -1           0            0          
+1083         datetime                                                           3             8       b        0            -1           0            0          
+1114         timestamp                                                          3             8       b        0            -1           0            0          
+1700         decimal                                                            3             -1      b        0            -1           0            0          
+142          xml                                                                3             -1      b        0            -1           0            0          
+14939        lo                                                                 3             -1      b        0            -1           0            0          
+2278         void                                                               3             4       p        0            -1           0            0          
+2249         record                                                             3             -1      p        0            -1           0            0          
+30           oidvector                                                          3             -1      b        0            -1           0            26         
 1000         _bool                                                              3             -1      b        0            -1           0            16         
 1002         _char                                                              3             -1      b        0            -1           0            18         
 1005         _int2                                                              3             -1      b        0            -1           0            21         
 1007         _int4                                                              3             -1      b        0            -1           0            23         
 1009         _text                                                              3             -1      b        0            -1           0            25         
+1028         _oid                                                               3             -1      b        0            -1           0            26         
 1014         _bpchar                                                            3             -1      b        0            -1           0            1042       
 1015         _varchar                                                           3             -1      b        0            -1           0            1043       
 1016         _int8                                                              3             -1      b        0            -1           0            20         
 1021         _float4                                                            3             -1      b        0            -1           0            700        
 1022         _float8                                                            3             -1      b        0            -1           0            701        
-1028         _oid                                                               3             -1      b        0            -1           0            26         
-1042         char                                                               3             1       b        0            -1           0            0          
-1043         string                                                             3             -1      b        0            -1           0            0          
-1082         date                                                               3             4       b        0            -1           0            0          
-1083         datetime                                                           3             8       b        0            -1           0            0          
-1114         timestamp                                                          3             8       b        0            -1           0            0          
 1115         _timestamp                                                         3             -1      b        0            -1           0            1114       
 1182         _date                                                              3             -1      b        0            -1           0            1082       
 1183         _time                                                              3             -1      b        0            -1           0            1083       
-1700         decimal                                                            3             -1      b        0            -1           0            0          
-2249         record                                                             3             -1      p        0            -1           0            0          
-2278         void                                                               3             4       p        0            -1           0            0          
 2287         _record                                                            3             -1      b        0            -1           0            2249       
-14939        lo                                                                 3             -1      b        0            -1           0            0          
-Row Count : 34
+2283         anyelement                                                         3             4       p        0            -1           0            0          
+Row Count : 36
 getColumnName  getColumnType  getCatalogName  getColumnClassName  getColumnLabel  getColumnTypeName  getSchemaName  getTableName  getColumnDisplaySize  getPrecision  getScale  isAutoIncrement  isCaseSensitive  isCurrency  isDefinitelyWritable  isNullable  isReadOnly  isSearchable  isSigned  isWritable  
 oid            4              PartsSupplier   java.lang.Integer   oid             integer            pg_catalog     pg_type       11                    10            0         false            false            false       false                 2           true        true          false     false       
 typname        12             PartsSupplier   java.lang.String    typname         string             pg_catalog     pg_type       4000                  4000          0         false            false            false       false                 2           true        true          false     false       



More information about the teiid-commits mailing list