[SQL] find open transactions/locks in 7.2?

2003-06-09 Thread george young
[select version() --> PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 3.0.4] I'm getting hangups every day or so, I presume due to some open transaction that insert/update/delete'ed on a table that is used by my main app without a commit. Is there some way (in 7.2!) to find who's locking wha

[SQL] Retype

2003-06-09 Thread Rado Petrik
Hi, I have query " SELECT id_user FROM user WHERE (freg_u & 2 ) > 0 ". freg_u is type smallint. Query return this error. PostgreSQL query failed: ERROR: Unable to identify an operator '&' for types 'smallint' and 'integer' You will have to retype this query using an explicit cast in How I

Re: [SQL] "Join" on delimeter aggregate query

2003-06-09 Thread Michael A Nachbaur
Thanks very much, this helps immensely. I've worked with functions before, but never aggregates. I guess there's some more bedtime reading for me to look into now. Re: sorting, this is not important to me, but I will keep the issues brought up by Tom Lane in mind when I use this. On Saturday

[SQL] how to determine array size

2003-06-09 Thread Forest Wilkinson
I need to enumerate the constraints on any given column in a table, so I'm examining pg_constraint to get the relevant information. The conkey array contains a list of constrained columns, and although I am able to check conkey[1] for constraints on a single column, I would like to properly handle

Re: [SQL] Creating Views with Column Names based on Distinct

2003-06-09 Thread Frank Bax
At 10:59 AM 6/6/03, Damien Dougan wrote: I was wondering if it is possible to create a table view based on a table which is effectively an "attribute list". For example, suppose I have two tables: CREATE TABLE user ( userid integer, username character varying, userpassword character varying,

Re: [SQL] Column limits in table/ views

2003-06-09 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: > On Fri, 2003-06-06 at 18:02, A.M. wrote: >> I have 560 columns of NUMERIC(10,14). To not run up against max column=20 >> restraints, I split the information into two tables. Does the column=20 >> limit on tables imply the same limit for views or selects or c

[SQL] Coalesce/Join/Entries may not exist.

2003-06-09 Thread James Taylor
I've got three tables, I'll shorten the columns down just so you get the idea: lists --- id|order_id list_results id|lid|total orders id|max All of the columns are int's. What I'm trying to do is something like: select (o.max-coalesce(sum(lr.total),0)) from o

Re: [SQL] "Join" on delimeter aggregate query

2003-06-09 Thread Eivind Kvedalen
On Sun, 8 Jun 2003, Tom Lane wrote: > Eivind Kvedalen <[EMAIL PROTECTED]> writes: > > SELECT a, concat(b) FROM (SELECT a,b FROM test ORDER BY a,b) T GROUP BY a; > > > The ORDER BY is included to sort the rows before they are aggregated. I'm > > not sure that this guarantees that they actually will

Re: [SQL] Using a RETURN NEXT

2003-06-09 Thread Mendola Gaetano
From: "Mr Weinbach, Larry" <[EMAIL PROTECTED]> > But at execution time I am getting thi error : > > WARNING: Error occurred while executing PL/pgSQL > function word_case > WARNING: line 5 at return next > ERROR: Set-valued function called in context that > cannot accept a set > > I also tried

Re: [SQL] "Join" on delimeter aggregate query

2003-06-09 Thread Tom Lane
Eivind Kvedalen <[EMAIL PROTECTED]> writes: > Ok. What I actually had in mind was whether the optimizer would remove the > ORDER BY clause completely or not, No. If you put an ORDER BY in a subselect, I think the system should honor it. regards, tom lane

Re: [SQL] Column limits in table/ views

2003-06-09 Thread Gaetano Mendola
"A.M." <[EMAIL PROTECTED]> wrote: > I have 560 columns of NUMERIC(10,14). To not run up against max column > restraints, I split the information into two tables. Does the column > limit on tables imply the same limit for views or selects or could I > potentially select a row across both table

Re: [SQL] "Join" on delimeter aggregate query

2003-06-09 Thread Tom Lane
Eivind Kvedalen <[EMAIL PROTECTED]> writes: > SELECT a, concat(b) FROM (SELECT a,b FROM test ORDER BY a,b) T GROUP BY a; > The ORDER BY is included to sort the rows before they are aggregated. I'm > not sure that this guarantees that they actually will be sorted, but maybe > some of the postgresql

Re: [SQL] Column limits in table/ views

2003-06-09 Thread Rod Taylor
On Fri, 2003-06-06 at 18:02, A.M. wrote: > I have 560 columns of NUMERIC(10,14). To not run up against max column > restraints, I split the information into two tables. Does the column > limit on tables imply the same limit for views or selects or could I > potentially select a row across both t