[SQL] function expression in FROM may not refer to other relations of same query level

2004-08-10 Thread Philippe Lang
Hello, I'm trying to use the ROWTYPE return value of a plpgsql function in a SELECT query. The test code is below. The following query is accepted: select id, usr, code, line1, line2 from tbl, get_lines(1); idusr code line1 line2 -- 1 one 1

Re: [SQL] Stored procedures and "pseudo" fields

2004-08-10 Thread Christoph Haller
Lars Erik Thorsplass wrote: > On Tue, 20 Jul 2004 09:45:06 -0600, Scott Marlowe <[EMAIL PROTECTED]> wrote: > > > Kinda like this: > > > > > > SELECT *, acl_check( objects.obid, ) AS mode FROM objects > > > WHERE mode > 0; > > > > Here's the problem. In order to do the select, the query first need

[SQL] sleep function

2004-08-10 Thread John DeSoi
Is there a sleep function of some kind? I wanted to simulate a query taking a long time to execute for testing purposes. Thanks, John DeSoi, Ph.D. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.pos

Re: [SQL] sleep function

2004-08-10 Thread Bruce Momjian
John DeSoi wrote: > Is there a sleep function of some kind? I wanted to simulate a query > taking a long time to execute for testing purposes. I can't think of one, no. I think you will have to use one of the server-side languages and call a sleep in there. -- Bruce Momjian

Re: [SQL] function expression in FROM may not refer to other relations

2004-08-10 Thread Joe Conway
Philippe Lang wrote: But the same query with a parameter returns an error: select id, usr, code, line1, line2 from tbl, get_lines(code); --> ERROR: function expression in FROM may not refer to other relations of same query level This is as expected and required -- you cannot refer to other FROM

[SQL] ERROR: Cross-database references are not implemented

2004-08-10 Thread Theo Galanakis
Title: ERROR: Cross-database references are not implemented How do I explicidly create a cross-database reference? Mind you these databases are on the same server. In MSSQL you could do that through enterprise manager. Any help would be appreciated. __

Re: [SQL] ERROR: Cross-database references are not implemented

2004-08-10 Thread Joe Conway
Theo Galanakis wrote: How do I explicidly create a cross-database reference? Mind you these databases are on the same server. In MSSQL you could do that through enterprise manager. Any help would be appreciated. You cannot do cross database references per se, but you can use schemas, which roughly

Re: [SQL] ERROR: Cross-database references are not implemented -

2004-08-10 Thread Theo Galanakis
Title: RE: [SQL] ERROR: Cross-database references are not implemented - RESOLVED Thanks Joe. After I posted this message, I googled around until I realized when you mentioned below. Theo -Original Message- From: Joe Conway [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 11 August 2004

[SQL] Wierded error in recursive function; debugging ideas?

2004-08-10 Thread Josh Berkus
Folks, I'm seeing this bizarre, unreproducable error in my logs: [2] Wrong datatype for second argument in call to in_array   SQL: SELECT sf_event_decendants(66645,111) The problem is that it's proven completely impossible to reproduce this error at test time; it only seems to happen in product

Re: [SQL] Wierded error in recursive function; debugging ideas?

2004-08-10 Thread Joe Conway
Josh Berkus wrote: I'm seeing this bizarre, unreproducable error in my logs: [2] Wrong datatype for second argument in call to in_array SQL: SELECT sf_event_decendants(66645,111) I also checked for in_array and it's not a visible built-in function. Is this maybe a PostgreSQL bug? Version is 7

Re: [SQL] function expression in FROM may not refer to other relations of same query level

2004-08-10 Thread Philippe Lang
Hello, > Whats wrong with just using CASE: > > select id, usr, code, > case when code = 1 then 'A' else 'Z' end as line1, > case when code = 1 then 'A' else 'Z' end as line2 from tbl; The code I showed in my last mail was actually test code only. The logic is more complicated, and I'm n