Path: utzoo!attcan!uunet!cs.utexas.edu!usc!ucsd!ucbvax!mtxinu!sybase!ohday!tim From: tim@ohday.sybase.com (Tim Wood) Newsgroups: comp.databases Subject: Re: flakey Obj-C/Sybase stuff Message-ID: <9941@sybase.sybase.com> Date: 29 Jun 90 18:26:00 GMT References: <1990Jun26.073113.682@pegasus.com> <1990Jun27.023244.4648@pegasus.com> Sender: news@Sybase.COM Organization: Sybase, Inc. Lines: 43 In article <1990Jun27.023244.4648@pegasus.com> jkwood@pegasus.com (Keith Wood) writes: >Well, the good news is that I found the problem on my own. >The bad news is that Sybase's error messages were rather misleading... Or SQL syntax is misleading. SQL unnecessarily widens the gap between what one says and what one means. Your reaction is understandable, but read on: >In my actual program listing the final column specification for fieldC >did not have a space following it, so the command buffer thought that I >was selecting fieldCfrom. > dbcmd(dbproc, "select fieldA, "); > dbcmd(dbproc, "fieldB, fieldC"); <-- problem is here > dbcmd(dbproc, "from tableC "); > dbcmd(dbproc, "where dataKey = -1"); > >Why sybase then decides to report EVERY COLUMN as an 'Invalid column name' >is somewhat beyond me, but that's the case... Well, let's parse the errant query: SELECT fieldA, /* identifier */ fieldB, /* identifier */ fieldCfrom /* identifier */ tableC /* correlation variable */ WHERE dataKey /* identifer */ = /* relop */ -1 /* constant */ The identifers are treated as column names and the names are invalid because there is no table in the query (which contains those columns). It sounds like you would prefer an error message like "what you're SELECTing look an awful lot like column names but the query doesn't reference any tables." However, how long would disbelief in the assertion that there are no tables last? -TW Sybase, Inc. / 6475 Christie Ave. / Emeryville, CA / 94608 415-596-3500 tim@sybase.com {pacbell,pyramid,sun,{uunet,ucbvax}!mtxinu}!sybase!tim This message is solely my personal opinion. It is not a representation of Sybase, Inc. Ohday.