Re: [GENERAL] Recovering deleted or updated rows

2006-11-15 Thread Tom Lane
"Florian G. Pflug" <[EMAIL PROTECTED]> writes: > I'm looking for a way to recover deleted or old versions of > accidentally updated rows from a postgres 7.4 database. I've > verified that the relevant tables haven't been vacuumed since > the accident took place. > I was thinking that it might work

Re: [GENERAL] ORDER BY

2006-11-15 Thread John Sidney-Woollett
Alternative options for what they're worth - you'd have to explain to see how efficient they are select id, name from ( select lower(name) as sortkey, id, name from table where name != 'Other' union select 'z' as sortkey, id, name from table where name = 'Other' ) as t order by sortkey

Re: [GENERAL] schema rename - is analyze necessary?

2006-11-15 Thread Tom Lane
[EMAIL PROTECTED] writes: > Hello, I just have a simple question. If I rename a schema, do I need > to re-analyze the schema to refresh statistics, Nope ... and not table or column rename either. regards, tom lane ---(end of broadcast)-

Re: [GENERAL] empty folder for downlaoding PostgreSQL 8.1.5 for FC4

2006-11-15 Thread surabhi.ahuja
hi, I downloaded the postgresql-8.1.5-6PGDG.src.rpm from a diffrent mirror however when i do rpmbuild --rebuikd I get the following error: Installing postgresql-8.1.5-6PGDG.src.rpm error: Failed build dependencies: tcl-devel is needed by postgresql-8.1.5-6PGDG.x86_64 thanks, regards

Re: [GENERAL] empty folder for downlaoding PostgreSQL 8.1.5 for FC4

2006-11-15 Thread Devrim GUNDUZ
Hi, On Thu, 2006-11-16 at 10:47 +0530, surabhi.ahuja wrote: > error: Failed build dependencies: > tcl-devel is needed by postgresql-8.1.5-6PGDG.x86_64 It says "I need tcl-devel RPM in order to build this package". Install tcl-devel RPM. Regards, -- The PostgreSQL Company - Command Prom

[GENERAL] dependency on 32 bit libpq.so on 64 bit Postgres server.

2006-11-15 Thread surabhi.ahuja
Hi I have downloaded Postgres 8.1.4 for FC4 x86_64 bit arch. and installed on my m/c Earlier this machine had Postgres 8.0.0. However that time It was the normal 32 bit server. I build my project (which has dependency on libpq.so) and so i have the libraries which i copy onto the above machi

Re: [GENERAL] Transaction id wraparound problem

2006-11-15 Thread Ed L.
On Wednesday November 15 2006 4:18 pm, Morris Goldstein wrote: > If I'm vacuuming every day (or two), and not running anywhere > near 1 billion transactions a day, why am I running into > transaction id wraparound problems? > Is this just complaining that template0 and template1 haven't > been vac

[GENERAL] Transaction id wraparound problem

2006-11-15 Thread Morris Goldstein
I've encountered transaction wraparound problems in a long-running test using postgresql 7.4.8. There is no critical data at risk, but I do need to understand the problem and get a fix into our product as quickly as possible. My postgres log file has messages like this: 2006-11-14 04:08:19 [2

Re: [GENERAL] ORDER BY

2006-11-15 Thread George Pavlov
> For larger tables, you may have to resort to a > union: > >select * from foo where name != 'Other' order by name >union >select * from foo where name = 'Other' Alas, this suggestion is wrong on two counts: (a) UNION expects a single ORDER BY that applies to the whole recordset and

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/15/06 15:51, Martijn van Oosterhout wrote: > On Wed, Nov 15, 2006 at 03:25:38PM -0600, Ron Johnson wrote: >> However, what if the WAL is not on the SAN? You'd have to shut down >> pg anyway, in order to copy the WAL to a new directory, no? > >

Re: [GENERAL] Out of memory (Failed on request size 24)

2006-11-15 Thread Rob Owen
Thanks Tom. It's all working again now. -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 14, 2006 6:10 PM To: Rob Owen Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Out of memory (Failed on request size 24) "Rob Owen" <[EMAIL PROTECTED]> writ

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Martijn van Oosterhout
On Wed, Nov 15, 2006 at 03:25:38PM -0600, Ron Johnson wrote: > However, what if the WAL is not on the SAN? You'd have to shut down > pg anyway, in order to copy the WAL to a new directory, no? You have to copy the *entire* cluster, you cannot split out one database, for example. Two postmaster in

Re: [GENERAL] ORDER BY

2006-11-15 Thread Alexander Staubo
On Nov 14, 2006, at 23:03 , MicroUser wrote: I need sorted result but the way like this: 0 | Anna 3 | Fernando 2 | Link 1 | Other Record '1 | Other' must by at the end of query result. It's not apparent from your example that you want something other than a purely lexicographic sort order

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/15/06 14:46, Martijn van Oosterhout wrote: >> How does it know what a crashed PostgreSQL database look like? >> >> Besides, active transactions need to be *rolled back*, not written >> ahead, since half the data hasn't been sent from the computer

Re: [GENERAL] Data conversion tools?

2006-11-15 Thread Adrian Klaver
If you don't mind an intermediate step you could use Pg2xbase http://www.klaban.torun.pl/prog/pg2xbase/ This program takes dbf files and inputs them into Postgres. It has an option for lower casing field names. You can specify the table name when you do the conversion. On Wednesday 15 November 20

Re: [GENERAL] Discover temporary INDEX/TABLE name

2006-11-15 Thread Jerry Sievers
"Ilja Golshtein" <[EMAIL PROTECTED]> writes: > Hello! > > >How could I find out if a temporary table > >(or index on a temporary table) was created > >by current session? > > May be the better question to ask is > how one can find out the temporary > schema name associated with the session. s

Re: [GENERAL] ORDER BY

2006-11-15 Thread Niklas Johansson
On 14 nov 2006, at 23.03, MicroUser wrote: I need sorted result but the way like this: 0 | Anna 3 | Fernando 2 | Link 1 | Other Record '1 | Other' must by at the end of query result. How I can get it? Well, maybe not the answer you're looking for, but a rather clean way to do this would

Re: [GENERAL] Discover temporary INDEX/TABLE name

2006-11-15 Thread Marcus Engene
Ilja Golshtein skrev: Hello! How could I find out if a temporary table (or index on a temporary table) was created by current session? The problem is something like SELECT COUNT(*) FROM PG_INDEXES WHERE INDEXNAME='tmpind1' does not work since temporary indexes from other sessions are visible

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Martijn van Oosterhout
> How does it know what a crashed PostgreSQL database look like? > > Besides, active transactions need to be *rolled back*, not written > ahead, since half the data hasn't been sent from the computer yet. There's a section of the docs dealing with this: http://www.postgresql.org/docs/8.1/static/

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/15/06 14:28, Martijn van Oosterhout wrote: > On Wed, Nov 15, 2006 at 01:41:47PM -0600, Ron Johnson wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 11/15/06 09:47, Jim Nasby wrote: >>> On Nov 14, 2006, at 3:44 PM, Paul Silveira

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Martijn van Oosterhout
On Wed, Nov 15, 2006 at 01:41:47PM -0600, Ron Johnson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 11/15/06 09:47, Jim Nasby wrote: > > On Nov 14, 2006, at 3:44 PM, Paul Silveira wrote: > [snip] > > Rule 2 is needed to ensure that the data files in the database are all > > consi

Re: [GENERAL] PgSQL not recognized

2006-11-15 Thread Martijn van Oosterhout
On Tue, Nov 14, 2006 at 12:28:33PM -0800, [EMAIL PROTECTED] wrote: > Obviously not as good I should have. I missed the begin and the end, > adding those solved the problem. I am new to Postgres and it is quite > differently designed compared to what I have been using so far, I just > thought I coul

[GENERAL] How to crash postgres using savepoints

2006-11-15 Thread Joseph Shraibman
See example below. At the very least the documentation needs to tell users that savepoints use shared memory, and the cofusing HINT string needs to be changed to something more useful. When run on a machine running 8.2b3 version: PostgreSQL 8.2beta3 on i686-pc-linux-gnu, compiled by GCC gcc

Re: [GENERAL] ORDER BY

2006-11-15 Thread Ashley Moran
On Nov 14, 2006, at 10:03 pm, MicroUser wrote: Hi. I have a table: ID | Name 0 | Anna 1 | Other 2 | Link 3 | Fernando I need sorted result but the way like this: 0 | Anna 3 | Fernando 2 | Link 1 | Other Record '1 | Other' must by at the end of query result. How I can get it? Thx. I s

[GENERAL] Data conversion tools?

2006-11-15 Thread Dan Armbrust
I'm trying to convert a database from either MS Access or MySQL into Postgres. I have found a couple of tools that will almost do what I want - but not quite. To make things match up with code that is already written - I need to have all of the table names and column names converted to lower

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/15/06 09:47, Jim Nasby wrote: > On Nov 14, 2006, at 3:44 PM, Paul Silveira wrote: [snip] > Rule 2 is needed to ensure that the data files in the database are all > consistent to each other. If you have a SAN/filesystem with snapshot > capability

Re: RE : Re: [GENERAL] database design ...

2006-11-15 Thread Brent Wood
Raymond O'Donnell wrote: Apologies, my reply should have gone to the list. To answer your question, the sort of thing I'm thinking of is the case where, maybe, one copy of a book is missing a page or two (not unknown in a school library) - the first scenario can't record this, nor can it tell wh

[GENERAL] schema rename - is analyze necessary?

2006-11-15 Thread mwrynn
Hello, I just have a simple question. If I rename a schema, do I need to re-analyze the schema to refresh statistics, or are the stats unaffected by the rename? Thank you, Mark ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner wil

[GENERAL] ORDER BY

2006-11-15 Thread MicroUser
Hi. I have a table: ID | Name 0 | Anna 1 | Other 2 | Link 3 | Fernando I need sorted result but the way like this: 0 | Anna 3 | Fernando 2 | Link 1 | Other Record '1 | Other' must by at the end of query result. How I can get it? Thx. ---(end of broadcast)---

Re: [GENERAL] can't start postgresql

2006-11-15 Thread Igor Shevchenko
On Tuesday 14 November 2006 17:21, Enrico wrote: > > Thanks, but this is not working - > > > > [EMAIL PROTECTED] ~]$ /usr/pgsql/bin/initdb -D /usr/pgsql/data > > The files belonging to this database system will be owned by user > > "postgres". This user must also own the server process. > > > > The

Re: [GENERAL] PgSQL not recognized

2006-11-15 Thread [EMAIL PROTECTED]
> Have you read the documentation for the creation of functions? And > looked at the examples? > > http://www.postgresql.org/docs/8.1/static/plpgsql.html Obviously not as good I should have. I missed the begin and the end, adding those solved the problem. I am new to Postgres and it is quite diffe

[GENERAL] Not your father's question about deadlocks

2006-11-15 Thread Clarence Gardner
Once upon a time, I put a question regarding deadlocks to the group, and Tom Lane immediately answered with this: >The guy waiting on the tuple-specific lock is second in >line to actually mung the tuple. Whoever is first in line behind the >current tenant will be blocked trying to acquire Share

Re: [GENERAL] Discover temporary INDEX/TABLE name

2006-11-15 Thread Ilja Golshtein
Hello! >How could I find out if a temporary table >(or index on a temporary table) was created >by current session? May be the better question to ask is how one can find out the temporary schema name associated with the session. -- Best regards Ilja Golshtein ---(end

Re: [GENERAL] sync linux and postgresql users and groups

2006-11-15 Thread brian
Toni Casueps wrote: Is this possible? It want to avoid the need for two passwords, one for login and another one for the database. The user accounts and the Postgresql server are on the same machine. See pg_hba.conf You want ident sameuser under "METHOD". Don't forget to run # pg_ctl rel

[GENERAL] sync linux and postgresql users and groups

2006-11-15 Thread Toni Casueps
Is this possible? It want to avoid the need for two passwords, one for login and another one for the database. The user accounts and the Postgresql server are on the same machine. _ Moda para esta temporada. Ponte al día de todas

[GENERAL] Discover temporary INDEX/TABLE name

2006-11-15 Thread Ilja Golshtein
Hello! How could I find out if a temporary table (or index on a temporary table) was created by current session? The problem is something like SELECT COUNT(*) FROM PG_INDEXES WHERE INDEXNAME='tmpind1' does not work since temporary indexes from other sessions are visible. I need a way to make a

Re: [GENERAL] Data corruption

2006-11-15 Thread Ardian Xharra
Yes, the Symantec Antivirus. We are going to modify A/V to not scan the database Thanks for your time - Original Message - From: "Shelby Cain" <[EMAIL PROTECTED]> To: "Ardian Xharra" <[EMAIL PROTECTED]> Cc: "postgreSQL postgreSQL" Sent: Wednesday, November 15, 2006 11:38 AM Subject: R

Re: [GENERAL] The old Insert and retrieving your Serial problem in

2006-11-15 Thread Jim Nasby
I think it is. There are also functions that will tell you what the sequence for a given field in a given table is (might also be new in 8.1, but you could probably recreate them yourself). Also, in 8.2 you'll be able to do INSERT ... RETURNING, which can return the id directly back to you.

Re: [GENERAL] Using SAN Splits to instantly copy a DB

2006-11-15 Thread Jim Nasby
On Nov 14, 2006, at 3:44 PM, Paul Silveira wrote: Does anyone know if it is possible to use SAN Splitting (the function of splitting a mirror of disks so that there are two idential copies of a Postgres Instance)? There are essentially 2 rules for doing a filesystem-level copy of the databa

Re: [GENERAL] autovac hung/blocked

2006-11-15 Thread Jim Nasby
On Nov 14, 2006, at 1:02 PM, Ed L. wrote: On Tuesday November 14 2006 12:56 pm, Jim C. Nasby wrote: You don't have the vacuum cost delay settings set unreasonably high, do you? On Tuesday November 14 2006 12:56 pm, you wrote: You don't have the vacuum cost delay settings set unreasonably high,

Re: [GENERAL] connectby usage question

2006-11-15 Thread Jim Nasby
contrib/ltree might be of use to you. On Nov 14, 2006, at 3:46 PM, Eric E wrote: We're trying to use connectby to transform a tree into an ordered set of rows, specifically requirements rows. We have data stored in a table with keyid and parent_id, as described in the examples for keyid is

Re: [GENERAL] autovac hung/blocked

2006-11-15 Thread Ed L.
On Wednesday November 15 2006 6:30 am, Alvaro Herrera wrote: > > > The table in > > question appears to be the pathological case for vacuum: > > very large with lots of frequent UPDATEs. It's essentially > > a log table. > > A big log table where the log entries are being updated? > Certainly so

Re: [GENERAL] Data corruption

2006-11-15 Thread Shelby Cain
Do you have antivirus software installed on the server? I seem to recall A/V software being a common source of "permission denied" errors when running Postgresql on Windows. Regards, Shelby Cain - Original Message From: Ardian Xharra <[EMAIL PROTECTED]> To: Jeff Davis <[EMAIL PROTECT

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello Gurjeet!   Tried your suggestion but this is just a marginal improvement. Our query needs 126 ms time, your query 110 ms. I do not see an index access on the component table Do you have an index on component.component_id?

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, Gurjeet Singh <[EMAIL PROTECTED]> wrote: On 11/15/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: Is there any other, and more performat way, to get the last history entryfor a given date than this query?  Create an (independent) index on history_timestamp column and use a min/max i

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Matthias . Pitzl
Title: Nachricht Hello Gurjeet!   Tried your suggestion but this is just a marginal improvement. Our query needs 126 ms time, your query 110 ms.   Greetings, Matthias -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gurjeet SinghSent: Wednes

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Is there any other, and more performat way, to get the last history entryfor a given date than this query? Create an (independent) index on history_timestamp column and use a min/max in the subquery.More specifically, your query should look

Re: [GENERAL] PG_MODULE_MAGIC check in 8.2

2006-11-15 Thread Shelby Cain
I hadn't considered that. Thanks. Regards, Shelby Cain - Original Message From: Martijn van Oosterhout To: Shelby Cain <[EMAIL PROTECTED]> Cc: pgsql-general Sent: Wednesday, November 15, 2006 1:15:02 AM Subject: Re: [GENERAL] PG_MODULE_MAGIC check in 8.2 That said, do you have to sp

Re: [GENERAL] SQL subquery question

2006-11-15 Thread Rick Schumeyer
Thanks for the suggestion...it needed only one small change: update tsubset set k = t.k from t where t.f=tsubset.f; Thanks! Alban Hertroys wrote: Rick Schumeyer wrote: foreach f in tsubset update tsubset set k=(select k from t, tsubset where t.f=f); end Can this be done with one SQL stat

[GENERAL] Question about query optimization

2006-11-15 Thread Matthias . Pitzl
Hello! I have to tables, component with unchanging component data and a component_history table containing the history of some other values that can change in time. The table component_history holds a foreign key to the component_id column in the component table. The table component_history has a

Re: [GENERAL] SQL subquery question

2006-11-15 Thread Alban Hertroys
Rick Schumeyer wrote: > foreach f in tsubset > update tsubset set k=(select k from t, tsubset where t.f=f); > end > > Can this be done with one SQL statement? I think you mean update tsubset set k = t.k from t where t.f = f; -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)5

[GENERAL] SQL subquery question

2006-11-15 Thread Rick Schumeyer
I think this can be done with one SQL statement, but I'm not sure. I have two tables: table t contains key k, another field f, and a bunch of other stuff. In a poor design decision, table tsubset contains a small number of "pointers" to t. I should have used the k column; instead I used the

Re: [GENERAL] autovac hung/blocked

2006-11-15 Thread Alvaro Herrera
Ed L. wrote: > Well, I think we clearly have an HPUX CPU bottleneck (long pri > queue, high cpu utilization, high user cpu %, lots of processes > "blocked on pri"). > > It seems to get worst and slow all queries down across the board > when autovac tries to vacuum a 15GB table. I'm guessing t

Re: [GENERAL] The old Insert and retrieving your Serial problem in

2006-11-15 Thread Chris Mair
> That looks like the solution to my problem, thanks!...I tried running it > on my 8.0.8 server, but it wasn't found, I assume that's an 8.1 only > function? Note that the upcoming 8.2 release has a handy "returning" clause for insert: http://developer.postgresql.org/pgdocs/postgres/sql-inser

Re: [GENERAL] copy template X -> Y

2006-11-15 Thread Alban Hertroys
jef peeraer wrote: > is it possible to copy one template, say X to a new template , called Y ? CREATE DATABASE Y TEMPLATE X; > Or better, i want a sort of a basic template that can be used to create > a new schema. A template for a schema... Not directly AFAIK, but you can write SQL files to gen

[GENERAL] copy template X -> Y

2006-11-15 Thread jef peeraer
is it possible to copy one template, say X to a new template , called Y ? Or better, i want a sort of a basic template that can be used to create a new schema. jef ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Recovering deleted or updated rows

2006-11-15 Thread Marcin Mank
- Original Message - From: "Florian G. Pflug" <[EMAIL PROTECTED]> To: Sent: Wednesday, November 15, 2006 11:19 AM Subject: [GENERAL] Recovering deleted or updated rows > Hi > > I'm looking for a way to recover deleted or old versions of > accidentally updated rows from a postgres 7.4 d

Re: RE : Re: [GENERAL] database design ...

2006-11-15 Thread Jorge Godoy
Shane Ambler <[EMAIL PROTECTED]> writes: > I have only had a little exposure to barcode scanners - the one that a client > used just behaved as a keyboard, so there was no programming to support it, Besides this model there are also models that plug into the serial port and also USB ports. For b

[GENERAL] Recovering deleted or updated rows

2006-11-15 Thread Florian G. Pflug
Hi I'm looking for a way to recover deleted or old versions of accidentally updated rows from a postgres 7.4 database. I've verified that the relevant tables haven't been vacuumed since the accident took place. I was thinking that it might work to patch the clog so that the offending transaction

Re: [GENERAL] connectby usage question

2006-11-15 Thread Joe Conway
Eric E wrote: However, we would like to return a numbering the items based on the order they return, like so; 1 (first item) 1.1 (1 branch, 1st item) 1.2 (1 branch, 2nd item) 1.2.1 (1.2 branch, 1st item) 1.2.2 1.2.2.1 1.3 etc. Is there an option in connectby to do this directly, or do we n

Re: [GENERAL] ROWTYPE initialization question

2006-11-15 Thread Alban Hertroys
Jim C. Nasby wrote: > On Thu, Nov 09, 2006 at 04:37:23PM +0100, Alban Hertroys wrote: >> 'lo list, >> >> I have a plpgsql SP where I loop through a cursor. I have an internal >> variable that keeps the previous row, so that I can compare it with the >> current row in the cursor. >> Like so; >> >>

Re: [GENERAL] empty folder for downlaoding PostgreSQL 8.1.5 for FC

2006-11-15 Thread Devrim GUNDUZ
Hello, On Wed, 2006-11-15 at 13:37 +0530, surabhi.ahuja wrote: > Installing > /gsp-dist/blr/developer/surabi/PostgreSQL8.1.5/postgresql-8.1.5-6PGDG.src.rpm > error: unpacking of archive failed on > file /usr/src/redhat/SOURCES/postgresql-8.1.5.tar.bz2;455ac7b9: cpio: > read > error: > /gsp-dist/

Re: [GENERAL] empty folder for downlaoding PostgreSQL 8.1.5 for FC 4

2006-11-15 Thread surabhi.ahuja
Title: Re: [GENERAL] empty folder for downlaoding PostgreSQL 8.1.5 for FC 4 hi i downloaded the srpm from the location that you have specified for Refora core 4, x 86, 64 bit arch.   i am now trying to do: rpmbuild --rebuild /gsp-dist/blr/developer/surabi/PostgreSQL8.1.5/postgresql-8.1.5-6