[SQL] renaming columns... danger?

2000-10-26 Thread Michael Teter
hi. I just discovered that doing an alter table ... alter column (to rename a column) does not do a complete rename throughout the database. for example, say you have table a, with columns b and c. b is your primary key. now rename b to new_b. if you do a dump of the schema after you rename,

[SQL] "average" time

2000-10-26 Thread Ulf Mehlig
Hello out there, an ignorant's question: can I/how can I create an aggregate that performs this operation on a group of timestamp values: select some_column, min(timest)+(max(timest)-min(timest))/2 from mytable group by some_column; that is, an aggregate which calculate

[SQL] Nested Aggregate fonction & gouping attributes

2000-10-26 Thread Pitot
In my SELECT statement I fetch data from a view, and I have the 2 following errors: 1.When I use Aggregate function AVG, it returns "Aggregate function calls may not be nested" 2. When I use my PL/PGSQL function "HO()" it returns "Attribute req_preminter.datedemande must be GROUPed or used in an a

[SQL] HELP! ... pg_locale ???

2000-10-26 Thread Sandis Jerics
Hello folks, I got a headache now, cause our admin played with postgres settings, something about pg_locale, as he says. Perhaps the reason is elsewhere, i dont know. As result, now all queries, written inside the php code on multiply lines, returns the following: ERROR: parser: parse error at

Re: [SQL] Alternate Database Locations

2000-10-26 Thread indraneel
Is that a small d or a capital D? try this: postmaster -D $PGDATA2 -i -p 5431 & \Indraneel On Thu, 26 Oct 2000, Brian C. Doyle wrote: > Okay I am still doing something wrong here > > I set PGDATA2=/home/user1/database > export PGDATA2 > > then I start postmaster > postmaster -d PGDATA2 -i -p

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Peter Eisentraut
Brian C. Doyle writes: > Okay I am still doing something wrong here > > I set PGDATA2=/home/user1/database > export PGDATA2 > > then I start postmaster > postmaster -d PGDATA2 -i -p 5431 & postmaster -D $PGDATA -i -p 5431 >logfile 2>&1 and i get > > Can't create pid file: /usr/local/pgsql/d

Re: [SQL] Query Problem

2000-10-26 Thread Josh Berkus
Michael, > SELECT Data > FROM Table A > WHERE NOT EXISTS ( > SELECT * FROM Table_B, Table_C > WHERE Table_B.GroupID = TableC.GroupID > AND TableC.AccountID = 11 > ) > > I think that the not exists is a bit quicker than the NOT IN. Give it > a whirl. A *lot* faster. Like, 7x as fas

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Brian C. Doyle
Okay... I can now run as many postmasters as I could imagine... KICK BUTT I am still running into a problem with the "alternate database locations" and that is I seem to be able to only set up 1 other alternate location. After getting the first alt location setup Iset PGDATA2= /home/use

Re: [SQL] Query Problem

2000-10-26 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > Thus, I need to select: > SELECT Data FROM Table A > WHERE CaseID NOT IN ( > SELECT CaseID FROM Table_B, Table_C > WHERE Table_B.GroupID = TableC.GroupID > AND TableC.AccountID = 11) > The problem is, since Table_B and Table_C

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Tom Lane
"Brian C. Doyle" <[EMAIL PROTECTED]> writes: > Okay I am still doing something wrong here > I set PGDATA2=/home/user1/database > export PGDATA2 > then I start postmaster > postmaster -d PGDATA2 -i -p 5431 & I think you are confusing the "alternate database directory" stuff with having a separat

Re: [SQL] plperl

2000-10-26 Thread Peter Eisentraut
Jie Liang writes: > "../../../src/Makefile.global", line 304: Need an operator > make: fatal errors encountered -- cannot continue > su-2.04# > > what I need to do? Use GNU make. -- Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/

Re: [SQL] pg_atoi: error in "template1": can't parse "template1"

2000-10-26 Thread Tom Lane
Dronamraju Rajesh <[EMAIL PROTECTED]> writes: >I have installed postgres 6.5.1 on my RedHat Linux > box. The installation went smooth without any > problems. Now when i run initdb I got errors. > Adding template1 database to pg_database... > ERROR: pg_atoi: error in "template1": can't parse

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Tom Lane
"Brian C. Doyle" <[EMAIL PROTECTED]> writes: > createdb user1 -D 'PGDATA2' > it creates but it is putting it in /home/user/database > the first alt location i set up!!! Um, are you sure createdb is connecting to the right postmaster? When you use multiple postmasters you have to keep a close eye

Re: [SQL] Query Problem

2000-10-26 Thread Stephan Szabo
What is the explain output for the queries you've tried? Stephan Szabo [EMAIL PROTECTED] On Wed, 25 Oct 2000, Josh Berkus wrote: > > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B Join Table C where Table > C.accou

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Brian C. Doyle
Okay I am still doing something wrong here I set PGDATA2=/home/user1/database export PGDATA2 then I start postmaster postmaster -d PGDATA2 -i -p 5431 & and i get Can't create pid file: /usr/local/pgsql/data/postmaster.pid Is another postmaster (pid: 10686) running? What am I missing... I know

Re: [SQL] Add Constraint

2000-10-26 Thread Stephan Szabo
On Wed, 25 Oct 2000, Sivagami . wrote: > Hi all, > > I am a newbie to Postgresql, but I am familiar with SQL. I am trying to add a >constraint to my table using the ALTER TABLE command. The command goes like this : > > ALTER TABLE USER_SIGNUP ADD CONSTRAINT > P_USER_SIGNUP_USER_ID PRIMARY KEY

[SQL] pg_atoi: error in "template1": can't parse "template1"

2000-10-26 Thread Dronamraju Rajesh
Dear all, I have installed postgres 6.5.1 on my RedHat Linux box. The installation went smooth without any problems. Now when i run initdb I got errors. I have seen the Postgres FAQ also and have ensured that all the directories i,e /usr/local/pgsql, /home/postgres etc are owned by postgres su

Re: [SQL] Query Problem

2000-10-26 Thread Tomas Berndtsson
Josh Berkus <[EMAIL PROTECTED]> writes: > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B Join Table C where Table > C.account = 11 > > The relevant fields: > > Table_A > CaseID > Data > > Table_B > GroupID > CaseID

Re: [SQL] How to call a shell command in rule

2000-10-26 Thread Jie Liang
Hi, but perl cannot be used in trigger yet :-( Clayton Cottingham wrote: > On Wed, 25 Oct 2000 10:44:48 -0700, Jie Liang said: > > > Hi, > > > > I want send a e-mail when the rows of mytable reaches 100,000, how? > > > > > > > > one way is to make a function using perl > and use say mail::se

Re: [SQL] plperl

2000-10-26 Thread Tom Lane
Jie Liang <[EMAIL PROTECTED]> writes: > su-2.04# make > "../../../src/Makefile.global", line 135: Need an operator > "../../../src/Makefile.global", line 139: Missing dependency operator Hmm, is "make" on your machine GNU make? If not try "gmake". regards, tom lane

Re: [SQL] Alternate Database Locations

2000-10-26 Thread indraneel
AFAIK the port number is compiled in, so you need to recompile. It's there in the docs somewhere. you have to use a different value for --with-pgport option in ./configure . On Wed, 25 Oct 2000, Brian C. Doyle wrote: > > I am still trying to find out how to get multiple postmasters running on

Re: [SQL] Surprising sequence scan when function call used

2000-10-26 Thread Hosokawa Tetsuichi
see functional index On Wed, 25 Oct 2000 13:26:51 -0400 "Will Fitzgerald" <[EMAIL PROTECTED]> wrote: > I have a table, login, which has a field by the same name; there's an index > on that field. I was surprised to discover that a SELECT which compares the > login field to a constant uses an Ind

[SQL] Query Problem

2000-10-26 Thread Josh Berkus
Folks: Here's the problem, in abstract: I need to select every record in table A that does not have a link in table B Join Table C where Table C.account = 11 The relevant fields: Table_A CaseID Data Table_B GroupID CaseID Amount Table_C GroupID AccountID Thus, I need to select: SELECT Dat

Re: [SQL] Problem whith Stored queries

2000-10-26 Thread Jie Liang
> Hi, anybody know how to call shell command in postgres rule or trigger, urgent!! -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.ipinc.com