Thread: indexing arrays in pgaccess's query interface is failing
Hi there, I am having some difficulties with using arrays in pgaccess relating to arrays. Here is an example schema: CREATE TABLE arraykeys ( akID int, akName varchar(12), PRIMARY KEY(akID) ); CREATE TABLE items ( itID serial, itProperties bool[], PRIMARY KEY(itID) ); --.. And some Data INSERT INTO arraykeys VALUES (1,'Active'); INSERT INTO arraykeys VALUES (2,'Overdue'); INSERT INTO arraykeys VALUES (3,'Local'); INSERT INTO items (itProperties) VALUES ( '{1,0,1}'); INSERT INTO items (itProperties) VALUES ( '{0,1,1}'); --.. And now the query that I am having problems with. SELECT itID, itProperties[akID], akName FROM items, arraykeys; In the readline client psql, the above select statement works perfectly scratch-# FROM items, arraykeys; itid | itproperties | akname ------+--------------+--------- 1 | t | Active 1 | f | Overdue 1 | t | Local 2 | f | Active 2 | t | Overdue 2 | t | Local (6 rows) However In pgaccess, when I try to execute the same query in query builder, I get the tcl error dialogue: Error: invalid command name "akID" Is there an alternate way indexing arrays in queries that I should be using? Or is pgaccess just not suitable for this class of queries! -- Best Regards David Stanaway ========================.--------------------------------------------- Technology Manager - Australia's Premier Internet Broadcasters david@NetVentures.com.au Office +612 9357 1699 ========================'---------------------------------------------
[ redirected to pgsql-interfaces, which seems a more appropriate venue ] David Stanaway <david@netventures.com.au> writes: > --.. And now the query that I am having problems with. > > SELECT itID, itProperties[akID], akName > FROM items, arraykeys; > > In pgaccess, > when I try to execute the same query in query builder, > I get the tcl error dialogue: > Error: invalid command name "akID" Someone isn't quoting the query string correctly on the Tcl side --- [akID] is Tclese for command substitution. Sounds like pgaccess expects the user to quote command punctuation characters that should be passed through. Not sure if that should be regarded as a bug or a feature. It could be considered a feature that you can enter SQL commands with Tcl command substitution performed on them, but it's something that would confuse non-Tcl-users a lot. regards, tom lane
Re: [INTERFACES] Re: indexing arrays in pgaccess's query interface is failing
From
Constantin Teodorescu
Date:
Tom Lane wrote: > > [ redirected to pgsql-interfaces, which seems a more appropriate venue ] > > David Stanaway <david@netventures.com.au> writes: > > --.. And now the query that I am having problems with. > > > > SELECT itID, itProperties[akID], akName > > FROM items, arraykeys; > > > > In pgaccess, > > when I try to execute the same query in query builder, > > I get the tcl error dialogue: > > Error: invalid command name "akID" > > Someone isn't quoting the query string correctly on the Tcl side --- > [akID] is Tclese for command substitution. Sounds like pgaccess expects > the user to quote command punctuation characters that should be passed > through. Not sure if that should be regarded as a bug or a feature. > It could be considered a feature that you can enter SQL commands with > Tcl command substitution performed on them, but it's something that > would confuse non-Tcl-users a lot. Got the message! I'll fix the Query builder to quote []'s! Teo