Re: [GENERAL] Duplicate Values or Not?!

2005-09-16 Thread Greg Stark
John Seberg <[EMAIL PROTECTED]> writes: > I recently tried to CREATE a UNIQUE INDEX and could > not, due to duplicate values: > > CREATE UNIQUE INDEX usr_login ON usr (login); > > To try to find the offending row(s), I then executed > the following: > > SELECT count(*), login FROM usr GROUP BY

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Fri, Sep 16, 2005 at 04:34:46PM -0700, Marc Munro wrote: >> On Fri, 2005-09-16 at 17:10 -0600, Michael Fuhr wrote: >> This is not currently seen as a priority (the work-around of "don't do >> that" is seen as sufficient). I'm simply hoping to get someo

Re: [GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Tom Lane
Bill Moseley <[EMAIL PROTECTED]> writes: > I couldn't get that to work -- Postgresql isn't that helpful just > reporting "ERROR: syntax error at or near ";" at character 496" even > after adding a FROM in the first select. So, I'm stabbing in the dark > to get it to work. [ not directly on topic

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Tom Lane
"Thomas O'Connell" <[EMAIL PROTECTED]> writes: > On Sep 16, 2005, at 9:18 AM, Bill Moseley wrote: >> First question is why the planner is not using an index scan when I >> use "now()" or CURRENT_TIMESTAMP? > It also used to be the case (pre-8.0; I couldn't find in the release > notes whether thi

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread brew
Marc > Yesterday a client application broke immediately after we issued a > pg_ctl reload command. The only change we had made was to pg_hba.conf > to enable trusted connections from localhost. Can you change pg_hba.conf back to what it had been prior and do a reload again and check if the

Re: [GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Bill Moseley
On Fri, Sep 16, 2005 at 04:56:25PM -0700, Roger Hand wrote: > So it would appear to me that you won't able to meet your goal by simply > using a view. > > However, there are other solutions you can use which may or may not be > appropriate. I can think of three at the moment. > > #1: Function S

Re: [GENERAL] Divide a float4 by 1 - what is going on???????

2005-09-16 Thread Michael Fuhr
On Sat, Sep 17, 2005 at 02:12:45AM +0200, Daniel Schuchardt wrote: > CIMSOFT=# SELECT n1/1 FROM test; > ?column? > -- > 2.45667695999146 > (1 row) > > Why I get so many digits by a division with one? Anybody should have > learned that everything / 1 = everything ;-) Looks lik

Re: [GENERAL] Divide a float4 by 1 - what is going on???????

2005-09-16 Thread Dann Corbit
Float provides 6-7 digits of precision. I see nothing surprising down below. > -Original Message- > From: [EMAIL PROTECTED] [mailto:pgsql-general- > [EMAIL PROTECTED] On Behalf Of Daniel Schuchardt > Sent: Friday, September 16, 2005 5:13 PM > To: pgsql-general@postgresql.org > Subject: [GE

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Michael Fuhr
On Fri, Sep 16, 2005 at 04:34:46PM -0700, Marc Munro wrote: > On Fri, 2005-09-16 at 17:10 -0600, Michael Fuhr wrote: > > Can you reproduce the problem with a reload? A stop and start will > > terminate client connections, but a reload shouldn't. > > This is not currently seen as a priority (the w

[GENERAL] Divide a float4 by 1 - what is going on???????

2005-09-16 Thread Daniel Schuchardt
Hi people, can anyone explain what is going on here : ? CIMSOFT=# CREATE TEMP TABLE test (n1 FLOAT4); CREATE TABLE CIMSOFT=# INSERT INTO test (n1) VALUES (2.456677); INSERT 6571521 1 CIMSOFT=# SELECT * FROM test; n1 - 2.45668 (1 row) CIMSOFT=# SELECT n1/1 FROM test; ?column? -

Re: [GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Roger Hand
>> > I have a view to generate a list of instructors and a count of their >> > future classes. >> > select * from instructor_counts where class_time > now(); >> > >> > But class_time is not part of the VIEW so that's not valid. >> >> No problem, just make it a part of the view. "No proble

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Marc Munro
Michael, Many thanks for your response; it is much appreciated. My responses are embedded below: On Fri, 2005-09-16 at 17:10 -0600, Michael Fuhr wrote: > On Fri, Sep 16, 2005 at 02:16:29PM -0700, Marc Munro wrote: > > It is Postgres 7.3.6. The client is a multi-threaded C++ client. The > > brea

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Michael Fuhr
On Fri, Sep 16, 2005 at 02:16:29PM -0700, Marc Munro wrote: > It is Postgres 7.3.6. The client is a multi-threaded C++ client. The > breakage was that one group of connections simply stopped. Others > contined without problem. It is not clear exactly what was going on. How did the connections

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Martijn van Oosterhout
On Fri, Sep 16, 2005 at 10:18:19AM -0700, Bill Moseley wrote: > On Fri, Sep 16, 2005 at 10:02:28AM -0500, Thomas O'Connell wrote: > > For older versions of postgres, it's recommended that you determine > > the time in the client and use constant data in your query. > > Interesting. I have a few

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Marc Munro
Michael, It is Postgres 7.3.6. The client is a multi-threaded C++ client. The breakage was that one group of connections simply stopped. Others contined without problem. It is not clear exactly what was going on. Nothing in our application logs gives us any clue to this. As for reproducibilit

Re: [GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Bill Moseley
On Fri, Sep 16, 2005 at 12:06:19PM -0700, Roger Hand wrote: > > select * from instructor_counts where class_time > now(); > > > > But class_time is not part of the VIEW so that's not valid. > > No problem, just make it a part of the view. See the classes section below. > > CREATE VIEW future

Re: [GENERAL] Replication

2005-09-16 Thread Matthew Terenzio
On Sep 16, 2005, at 4:30 PM, Russ Brown wrote: just because replication is included and part of the core of a database, it doesn't mean that it's reliable or well tested. I just jumped into this thread, and this statement just triggers one thought. Many Postgres end users rely on experts

Re: [GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Michael Fuhr
On Fri, Sep 16, 2005 at 01:28:13PM -0700, Marc Munro wrote: > Yesterday a client application broke immediately after we issued a > pg_ctl reload command. How did the client break? What behavior did it exhibit? Were there any errors in the server's logs? Can you duplicate the problem? What versi

Re: [GENERAL] Replication

2005-09-16 Thread Russ Brown
Scott Marlowe wrote: On Fri, 2005-09-16 at 12:51, Russ Brown wrote: Scott Ribe wrote: How about a third choice: you can also use a proven, reliable and tested replication solution that is included in the core system because the core system basiclly provides it anyway. Sure, but that one is

[GENERAL] pg_ctl reload breaks our client

2005-09-16 Thread Marc Munro
Yesterday a client application broke immediately after we issued a pg_ctl reload command. The only change we had made was to pg_hba.conf to enable trusted connections from localhost. My question is, how should the client application be affected by such a reload? My impression was that the client

[GENERAL] Duplicate Values or Not?!

2005-09-16 Thread John Seberg
I recently tried to CREATE a UNIQUE INDEX and could not, due to duplicate values: CREATE UNIQUE INDEX usr_login ON usr (login); To try to find the offending row(s), I then executed the following: SELECT count(*), login FROM usr GROUP BY login ORDER BY 1 DESC; The GROUP BY didn't group anything,

Re: [GENERAL] Replication

2005-09-16 Thread Scott Marlowe
On Fri, 2005-09-16 at 12:51, Russ Brown wrote: > Scott Ribe wrote: > >>How about a third choice: you can also use a proven, reliable and tested > >> replication solution that is included in the core system because the > >>core system basiclly provides it anyway. > > > > > > Sure, but that one is

Re: [GENERAL] Restoring just a table or row from a backup copy.

2005-09-16 Thread Scott Marlowe
On Fri, 2005-09-16 at 14:13, Fernando Lujan wrote: > Is there a way to do that? pg_dumpall --help pg_restore restores a PostgreSQL database from an archive created by pg_dump. Usage: pg_restore [OPTION]... [FILE] (SNIP) -t, --table=NAME restore named table (SNIP) -

Re: [GENERAL] Partial dates

2005-09-16 Thread Bruno Wolff III
On Wed, Sep 14, 2005 at 00:09:58 -0400, Joe <[EMAIL PROTECTED]> wrote: > > I'm not sure I agree with the need to "fix" or "sanitize" the data. The > columns in question are used mostly for publication dates. While you may > be able to find a full release date for recent books, they are gener

[GENERAL] Anyone use Eclipse?

2005-09-16 Thread Josh Berkus
People: The Eclipse project is interested in having PostgreSQL people contribute to their Data Services plug in. Do we have any java hackers in the community using Eclipse? Anyone interested? -- --Josh Josh Berkus Aglio Database Solutions San Francisco ---(end of b

[GENERAL] Restoring just a table or row from a backup copy.

2005-09-16 Thread Fernando Lujan
Is there a way to do that? Thanks in advance. Fernando Lujan ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Roger Hand
I have a view to generate a list of instructors and a count of their > future classes. > > "instructors" is a link table between "class" and "person". > > CREATE VIEW future_instructor_counts > AS > SELECT person.id AS person_id, > first_name, > last_n

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread Greg Stark
John DeSoi <[EMAIL PROTECTED]> writes: > > If you need data to propagate from the clients back to the server then > > things > > get more complicated. Even then you could side step a lot of headaches if > > you > > can structure the application in specific ways, such as guaranteeing that > >

Re: [GENERAL] Create a pg table from CSV with header rows

2005-09-16 Thread David Fetter
On Fri, Sep 16, 2005 at 10:41:59AM -0400, Doug Bloebaum wrote: > On 9/15/05, Michael Fuhr <[EMAIL PROTECTED]> wrote: > > > > On Thu, Sep 15, 2005 at 06:48:59PM -0400, Robert Fitzpatrick wrote: > > > Anyone know a package that can do this? Perferrably a Unix/Linux > > > package. > > > > It would b

[GENERAL] Setting WHERE on a VIEW with aggregate function.

2005-09-16 Thread Bill Moseley
I have a view to generate a list of instructors and a count of their future classes. "instructors" is a link table between "class" and "person". CREATE VIEW future_instructor_counts AS SELECT person.id AS person_id, first_name, last_name,

Re: [GENERAL] Neither column can be NULL if the column is part of the combination of primary key columns?

2005-09-16 Thread Jaime Casanova
> > To allow *col2* to be NULL and make record combination (col1, col2) > unique, I should setup > unique (col1, col2) ? > > Thanks, > Emi > no, you must create a partial unique index... create unique index indice_col2 on table(col1, col2) where col2 is not null; -- Atentamente, Jaime Casano

Re: [GENERAL] Replication

2005-09-16 Thread Russ Brown
Scott Ribe wrote: How about a third choice: you can also use a proven, reliable and tested replication solution that is included in the core system because the core system basiclly provides it anyway. Sure, but that one is spelled "Sybase", not "MySQL" ;-) It's amazing how misunderstood m

[GENERAL] Neither column can be NULL if the column is part of the combination of primary key columns?

2005-09-16 Thread Emi Lu
Greetings, A question about "combination of several columns " as primary key . A table test ( col1 timestamp not null default now(), col2 timestamp, primary key (col1, col2) ); If I setup primary key as the *combination* of (col1, col2), the col2 will be setup as "NOT NULL" automatically right

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Bill Moseley
On Fri, Sep 16, 2005 at 10:02:28AM -0500, Thomas O'Connell wrote: > > On Sep 16, 2005, at 9:18 AM, Bill Moseley wrote: > > >First question is why the planner is not using an index scan when I > >use "now()" or CURRENT_TIMESTAMP? > > It also used to be the case (pre-8.0; I couldn't find in the re

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Bill Moseley
On Fri, Sep 16, 2005 at 04:45:57PM +0200, Peter Eisentraut wrote: > The planner thinks your query will return 414 rows, so it thinks the > sequential scan is faster. In reality, your query only retuns 28 rows, so > you need to create better statistics, either by running ANALYZE or VACUUM (or >

Re: [GENERAL] Replication

2005-09-16 Thread Scott Ribe
> How about a third choice: you can also use a proven, reliable and tested > replication solution that is included in the core system because the > core system basiclly provides it anyway. Sure, but that one is spelled "Sybase", not "MySQL" ;-) -- Scott Ribe [EMAIL PROTECTED] http://www.kille

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread Scott Ribe
> The requirements scream ASP model except that this system needs to be > functional for disaster management where it's likely there won't be any > communications. At least, that's the constraint I've been given. I'm not an expert on this, but just kicking around the idea, the approach I think I'

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Thomas O'Connell
On Sep 16, 2005, at 9:18 AM, Bill Moseley wrote: First question is why the planner is not using an index scan when I use "now()" or CURRENT_TIMESTAMP? It also used to be the case (pre-8.0; I couldn't find in the release notes whether this was an 8.0 or 8.1 fix) that now() and CURRENT_TIME

Re: [GENERAL] Question about a query plan

2005-09-16 Thread Peter Eisentraut
Am Freitag, 16. September 2005 16:18 schrieb Bill Moseley: > First question is why the planner is not using an index scan when I > use "now()" or CURRENT_TIMESTAMP? > > > EXPLAIN ANALYZE select id from class where class_time > now(); > QUERY P

Re: [GENERAL] Create a pg table from CSV with header rows

2005-09-16 Thread Doug Bloebaum
On 9/15/05, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Thu, Sep 15, 2005 at 06:48:59PM -0400, Robert Fitzpatrick wrote:> Anyone know a package that can do this? Perferrably a Unix/Linux> package.It would be trivial to write a script in a language like Perl to read the first line of a file and gener

Re: [GENERAL] new.id has wrong value in INSERT RULE

2005-09-16 Thread Tom Lane
"Ian McFarland" <[EMAIL PROTECTED]> writes: > CREATE RULE table_b_insert_rule AS ON INSERT TO table_b > DO (UPDATE table_b SET active = 'f', yield = new.id WHERE table_a_id > = new.table_a_id AND id != new.id;); Rules are macros. Since what is substituted for new.id in this case is a nextv

Re: [GENERAL] Strange Bug in exim4 postgresql lookup code or libpq?

2005-09-16 Thread Tom Lane
Alexander Neumann <[EMAIL PROTECTED]> writes: >> 2005-09-01 18:19:01 [5462] LOG: unexpected EOF on client connection > So this is either caused by a strange (but reproduceable) race-condition or > it somehow depends on the connecting ip address of the other side's server. The "unexpected EOF" in

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread Peter Fein
Steve Manes wrote: > Greg Stark wrote: > >> My first reaction to this description was to consider some sort of >> model where >> the master database publishes text dumps of the master database which are >> regularly downloaded and loaded on the slaves. The slaves treat those >> tables >> as purely

[GENERAL] Question about a query plan

2005-09-16 Thread Bill Moseley
PostgreSQL 7.4.8 on i486-pc-linux-gnu, Debian Reading: http://www.postgresql.org/docs/8.0/static/performance-tips.html I'm just starting to look at query plans, and I'm not understanding a few things. I don't have that many questions, but I'm including my examples below, so it's a bit long. Fi

Re: [GENERAL] help needed for functions

2005-09-16 Thread A. Kretschmer
am 16.09.2005, um 6:51:16 -0700 mailte Nitin Ahire folgendes: > I am facing problems for stored procedures. Is their any way so that I > can transfer my existing stored procedure from mssql to postgre ? I guess: no. > > I already read about functions & tried to implement it but I could not >

Re: [GENERAL] help needed for functions

2005-09-16 Thread Dinesh Pandey
Yes, you can use “SETOF” for multiple records.   See Examples ---   CREATE TABLE department(id int primary key, name text); CREATE TABLE employee(id int primary key, name text, salary int, departmentid int references department);   -

[GENERAL] help needed for functions

2005-09-16 Thread Nitin Ahire
Hello All,   I am new to postgresql database. I am transferring current database from mssql database to postgresql 7.4   I am facing problems for stored procedures. Is their any way so that I can transfer my existing stored procedure from mssql to postgre ?   I already read about functions & trie

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-16 Thread hubert depesz lubaczewski
On 9/15/05, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: Yes, I did and I found an answer... :) you did what? read the docs?  But I am trying to use this function in a report designer and the result from the select is in the way of the real data from the fetch... Is there a way around this? and? as

Re: [GENERAL] Strange Bug in exim4 postgresql lookup code or libpq?

2005-09-16 Thread Alexander Neumann
Hi, * Martijn van Oosterhout wrote: > On Thu, Sep 15, 2005 at 03:14:10PM +0200, Alexander Neumann wrote: > > I'm using exim4 together with postgresql. Sometimes, data lookups fail > > mysteriously and on the exim side nobody was able to help. > > The server log said: > 2005-09-01 18:19:01 [5462

Re: [GENERAL] Strange Bug in exim4 postgresql lookup code or libpq?

2005-09-16 Thread Alexander Neumann
Hi, * Tom Lane <[EMAIL PROTECTED]> wrote: > Alexander Neumann <[EMAIL PROTECTED]> writes: > > In short terms: The result code is PGRES_FATAL_ERROR, but the error message > > is an empty string. > AFAIK that shouldn't happen, unless perhaps you are completely out of > memory in the client-side proc

[GENERAL] new.id has wrong value in INSERT RULE

2005-09-16 Thread Ian McFarland
Hi, To explain the problem as clearly as I can I've included the schema, rule, inserts, output and explanation below. CREATE TABLE table_a ( id serial PRIMARY KEY, nametext, active

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread Steve Manes
Greg Stark wrote: My first reaction to this description was to consider some sort of model where the master database publishes text dumps of the master database which are regularly downloaded and loaded on the slaves. The slaves treat those tables as purely read-only reference tables. If you n

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread John DeSoi
On Sep 15, 2005, at 9:54 PM, Greg Stark wrote: If you need data to propagate from the clients back to the server then things get more complicated. Even then you could side step a lot of headaches if you can structure the application in specific ways, such as guaranteeing that the clients