Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WuCm4-0007iN-R8 for pgsql-odbc@arkaria.postgresql.org; Tue, 10 Jun 2014 03:31:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WuCm3-00055c-JW for pgsql-odbc@arkaria.postgresql.org; Tue, 10 Jun 2014 03:30:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WuCm2-00055U-PN for pgsql-odbc@postgresql.org; Tue, 10 Jun 2014 03:30:58 +0000 Received: from 173-11-38-134-minnesota.hfc.comcastbusiness.net ([173.11.38.134] helo=johnspc.frickson.pvt) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WuClz-0008VI-1h for pgsql-odbc@postgresql.org; Tue, 10 Jun 2014 03:30:57 +0000 Received: from [173.11.38.132] (173-11-38-132-Minnesota.hfc.comcastbusiness.net [173.11.38.132]) by johnspc.frickson.pvt (Postfix) with ESMTP id 1B1FC2861F78 for ; Mon, 9 Jun 2014 22:30:51 -0500 (CDT) Message-ID: <1402371050.2977.15.camel@server.frickson.pvt> Subject: Table Aliases From: "John C. Frickson" To: PostgreSQL ODBC List Date: Mon, 09 Jun 2014 22:30:50 -0500 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Assume the following query: SELECT * FROM some_schema_name.some_table_name a LEFT JOIN other_schame_name.some_table_name b ON a.Foo=b.Bar Notice that the schemas are different, but the table names are the same. Now suppose both tables have an "Id" field. As I go through the columns, I call (among other things): SQLColAttribute(hstmt, colnum, SQL_DESC_BASE_TABLE_NAME, (UCHAR*)tablename, sizeof(tablename), <h, NULL); SQLColAttribute(hstmt, colnum, SQL_DESC_TABLE_NAME, (UCHAR*)alias, sizeof(alias), <h, NULL); The first call (SQL_DESC_BASE_TABLE_NAME) would return "some_table_name" for the Id columns in both schemas. When MySQL is the backend database, the second call (SQL_DESC_TABLE_NAME) would return "a" and "b" for the to Id columns, i.e. the table aliases. With PostgreSQL, the second call also returns "some_table_name". I can't find any attribute that has the table alias. Is there a way to get the table alias, or do I just have to code around it somehow? Thanks, John -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc