Re: [GENERAL] Debian problem...

2007-09-10 Thread 李彦 Ian Li
Maybe some Debian specific commands will help: pg_lsclusters: list clusters you have on the machine; pg_dropcluster: drop an existing cluster; pg_createcluster: create new cluster. Regards. Tom Allison wrote: Ran into a problem. I hosed up postgresql by deleting the data directory. So I though

Re: [GENERAL] Debian problem...

2007-09-10 Thread Ron St-Pierre
There's likely someone here that can help you, if you can give us some more info. To start with, did the uninstall even work? Ron Tom Allison wrote: Ran into a problem. I hosed up postgresql by deleting the data directory. So I thought I would just uninstall and reinstall postgres using De

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Trevor Talbot
> > The browser may not know the setting, or may not tell it to you, > > or you might not be able to make any sense of what it says > > (timezone names are hardly standardized). > > Well that's true. Except for numeric offsets. Offsets aren't good enough due to changing DST rules. A current offs

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/10/07 19:50, Tom Lane wrote: > Ron Johnson <[EMAIL PROTECTED]> writes: >> On 09/10/07 15:21, Alvaro Herrera wrote: >>> I wouldn't trust the browser's TZ, and you would need a way to >>> override it. > >> Why? > > The browser may not know the se

Re: [GENERAL] Ubuntu libraries needed

2007-09-10 Thread Andrej Ricnik-Bay
On 9/11/07, Ralph Smith <[EMAIL PROTECTED]> wrote: > I have a new install of 7.4 Ubuntu, and I'm looking for some advice on where > to get the libraries I need for the source configure and install to work. > Does anybody know off the top of their head where to look? You're not missing libraries (ma

Re: [GENERAL] Alternative to drop index, load data, recreate index?

2007-09-10 Thread Tom Lane
Jeff Davis <[EMAIL PROTECTED]> writes: > On Mon, 2007-09-10 at 17:06 -0700, Jason L. Buberel wrote: >> However, I now have tables so large that even the 'recreate all >> indices' step is taking too long (15-20 minutes on 8.2.4). > If you create the indexes with CONCURRENTLY, then you can write to

Re: [GENERAL] Debian problem...

2007-09-10 Thread Stephen Frost
* Tom Allison ([EMAIL PROTECTED]) wrote: > I hosed up postgresql by deleting the data directory. erp. That's no good. > So I thought I would just uninstall and reinstall postgres using Debian > packages. > Now I have nothing working. Huh, odd, that'd normally work, I think. > Wondering if any

[GENERAL] Debian problem...

2007-09-10 Thread Tom Allison
Ran into a problem. I hosed up postgresql by deleting the data directory. So I thought I would just uninstall and reinstall postgres using Debian packages. Now I have nothing working. Wondering if anyone here has any suggestions on what to do with a Debian installation. If not, I'm checki

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Tom Lane
Ron Johnson <[EMAIL PROTECTED]> writes: > On 09/10/07 15:21, Alvaro Herrera wrote: >> I wouldn't trust the browser's TZ, and you would need a way to >> override it. > Why? The browser may not know the setting, or may not tell it to you, or you might not be able to make any sense of what it says (

Re: [GENERAL] Postgresql 7.3 on Red Hat Enterprise 5 (Problem with SEMMNI, SEMMNS)

2007-09-10 Thread Tom Lane
Darek Czarkowski <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> BTW, I checked the CVS logs, and AFAICT this entry refers to the bug >> and patch shown in this thread: >> http://archives.postgresql.org/pgsql-general/2003-10/msg00888.php >> I'd be interested to know how your application is dependi

Re: [GENERAL] Alternative to drop index, load data, recreate index?

2007-09-10 Thread Scott Marlowe
On 9/10/07, Jason L. Buberel <[EMAIL PROTECTED]> wrote: > > When loading very large data exports (> 1 million records) I have found it > necessary to use the following sequence to achieve even reasonable import > performance: > > 1. Drop all indices on the recipient table > 2. Use "copy recipien

Re: [GENERAL] Alternative to drop index, load data, recreate index?

2007-09-10 Thread Jeff Davis
On Mon, 2007-09-10 at 17:06 -0700, Jason L. Buberel wrote: > When loading very large data exports (> 1 million records) I have > found it necessary to use the following sequence to achieve even > reasonable import performance: > > 1. Drop all indices on the recipient table > 2. Use "copy recipien

[GENERAL] Alternative to drop index, load data, recreate index?

2007-09-10 Thread Jason L. Buberel
When loading very large data exports (> 1 million records) I have found it necessary to use the following sequence to achieve even reasonable import performance: 1. Drop all indices on the recipient table 2. Use "copy recipient_table from '/tmp/input.file';" 3. Recreate all indices on the recip

[GENERAL] Ubuntu libraries needed

2007-09-10 Thread Ralph Smith
I have a new install of 7.4 Ubuntu, and I'm looking for some advice on where to get the libraries I need for the source configure and install to work. Does anybody know off the top of their head where to look? Thanks! - [EMAIL PROTECTED]:~/Desktop/postgresql-7.4.17$ ./configure -- prefix=

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/10/07 15:21, Alvaro Herrera wrote: [snip] > > I wouldn't trust the browser's TZ, and you would need a way to > override it. Why? - -- Ron Johnson, Jr. Jefferson LA USA Give a man a fish, and he eats for a day. Hit him with a fish, and he goe

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Alvaro Herrera
novnov escribió: > > I think I get the picture; this post is the closest to making sense to me (my > lack of understanding is the issue, obviously). But: > > What's the postgresql client, in a web app? > > When you write "The web app sets timezone='EST5EDT' and inserts a time of > '2007-07-11 12

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Martijn van Oosterhout
On Mon, Sep 10, 2007 at 12:44:04PM -0700, novnov wrote: > What's the postgresql client, in a web app? Your webapp *is* the postgresql client. The client is whatever opens the connection to the server. > When you write "The web app sets timezone='EST5EDT' and inserts a time of > '2007-07-11 12:30:

Re: [GENERAL] archive_command with an environnement variable ?

2007-09-10 Thread Greg Smith
On Thu, 6 Sep 2007, Eric Pailleau wrote: so I wonder if we can use environnement variable directly or by sourcing an env file, i.e : archive_command = 'test ! -f $myvar/%f && cp %p $myvar/%f' archive_command = 'csh ; source ~/.cshrc && test ! -f $myvar/%f && cp %p $myvar/%f' As far as I know

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread novnov
I think I get the picture; this post is the closest to making sense to me (my lack of understanding is the issue, obviously). But: What's the postgresql client, in a web app? When you write "The web app sets timezone='EST5EDT' and inserts a time of '2007-07-11 12:30:00'." that's the black box th

Re: [GENERAL] Statistics collection question

2007-09-10 Thread Martijn van Oosterhout
On Mon, Sep 10, 2007 at 07:05:54PM -, [EMAIL PROTECTED] wrote: > When I do a "select * from pg_locks", some of them show up as > "Exclusive Lock". This I suppose means that the whole table is locked, > right? How can I find from the "transaction id" which precise SQL > statement is taking this

Re: [GENERAL] Statistics collection question

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 4, 10:54 pm, [EMAIL PROTECTED] (Tom Lane) wrote: > "Phoenix Kiula" <[EMAIL PROTECTED]> writes: > > Would appreciate any help. Why do indexed queries take so much time? > > It's a simple DB with "10 relations" including tables and indexes. > > Simple inserts and updates, about 5000 a day, but

Re: [GENERAL] Database reverse engineering

2007-09-10 Thread RC Gobeille
Or this one: http://schemaspy.sourceforge.net/ On Sep 8, 2007, at 4:43 AM, A. Kretschmer wrote: am Sat, dem 08.09.2007, um 11:44:17 +0200 mailte Thorsten Kraus folgendes: Hello, I am looking for a tool which is able to generate a database diagramm including the relationships from an existi

Re: [GENERAL] audit sql queries

2007-09-10 Thread Jeff Davis
On Sun, 2007-09-09 at 23:13 +, Dan99 wrote: > 1. table(s) affected > 2. column(s) affected > 3. action performed on data (ie. update, insert, select, delete) > 4. previous data for each row and column effected (if data changed or > deleted) > 5. new data for each row and column effected (or exi

Re: [GENERAL] Postgresql 7.3 on Red Hat Enterprise 5 (Problem with SEMMNI, SEMMNS)

2007-09-10 Thread Darek Czarkowski
Tom Lane wrote: Darek Czarkowski <[EMAIL PROTECTED]> writes: I am sorry, it seams that my last replay never reached the list. I was looking for the list of changes for each version, but this document i= s bundled with the source. I believe it is the fix introduced in version 7.= 3.5: "* Fix i

Re: [GENERAL] Column Ordering

2007-09-10 Thread Scott Marlowe
On 9/10/07, Ashish Karalkar <[EMAIL PROTECTED]> wrote: > > > > Hello All, > > I am having a table with 5 columns. > I want to add another column by altering the table at 2nd position > constraint is that I can not drop and recreate the table as column ordering > is of importance. That doesn't mak

[GENERAL] Column Ordering

2007-09-10 Thread Ashish Karalkar
Hello All, I am having a table with 5 columns. I want to add another column by altering the table at 2nd position constraint is that I can not drop and recreate the table as column ordering is of importance. Is there anyway to do so. Thanks in advance. With regards Ashish...

Re: [GENERAL] Column ordering

2007-09-10 Thread brian
Ashish Karalkar wrote: Hello All, I am having a table with 5 columns. I want to add another column by altering the table at 2nd position constraint is that I can not drop and recreate the table as column ordering is of importance. Is there anyway to do so. Copy everything into a tmp table,

[GENERAL] Column ordering

2007-09-10 Thread Ashish Karalkar
Hello All, I am having a table with 5 columns. I want to add another column by altering the table at 2nd position constraint is that I can not drop and recreate the table as column ordering is of importance. Is there anyway to do so. Thanks in advance. With regards Ashish... ---

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Richard Huxton
novnov wrote: As far as I can see, my original premis is correct, that I need to tweak the stored datetime when returned for viewing in a browser to adjust for any user's tz setting...I'd be wrong if browsers automatically adjust any datetime for the requesting pc's tz setting. I don't think they

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/10/07 10:55, Scott Marlowe wrote: > On 9/10/07, novnov <[EMAIL PROTECTED]> wrote: >> Your explanation of now() and localtime() is good...but localtime() to >> postgres acting as a web app db, wouldn't it just return the local time as >> far as th

Re: [GENERAL] cast time interval to seconds

2007-09-10 Thread Pavel Stehule
2007/9/10, Martijn van Oosterhout <[EMAIL PROTECTED]>: > On Mon, Sep 10, 2007 at 08:44:07PM +0500, rihad wrote: > > Hi, I have two columns start_time & stop_time declared as "TIME". I'd > > like to compute the difference between the two times in seconds, all in db: > > > > SELECT > > (CAST(stop_t

Re: [GENERAL] cast time interval to seconds

2007-09-10 Thread Martijn van Oosterhout
On Mon, Sep 10, 2007 at 08:44:07PM +0500, rihad wrote: > Hi, I have two columns start_time & stop_time declared as "TIME". I'd > like to compute the difference between the two times in seconds, all in db: > > SELECT > (CAST(stop_time AS SECONDS) + 86400 - CAST(start_time AS SECONDS)) > % 8640

Re: [GENERAL] cast time interval to seconds

2007-09-10 Thread Michael Glaesemann
On Sep 10, 2007, at 10:44 , rihad wrote: SELECT (CAST(stop_time AS SECONDS) + 86400 - CAST(start_time AS SECONDS)) % 86400; "seconds" isn't a datatype. Try extract(epoch from (stop_time - start_time)) The manual is quite extensive: http://www.postgresql.org/docs/8.2/interactive/funct

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Scott Marlowe
On 9/10/07, novnov <[EMAIL PROTECTED]> wrote: > Your explanation of now() and localtime() is good...but localtime() to > postgres acting as a web app db, wouldn't it just return the local time as > far as the server is concerned? No, it would return it as the local time of the POSTGRESQL client.

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Martijn van Oosterhout
On Mon, Sep 10, 2007 at 08:34:55AM -0700, novnov wrote: > Your explanation of now() and localtime() is good...but localtime() to > postgres acting as a web app db, wouldn't it just return the local time as > far as the server is concerned? It will return localtime relative to whatever you've confi

[GENERAL] cast time interval to seconds

2007-09-10 Thread rihad
Hi, I have two columns start_time & stop_time declared as "TIME". I'd like to compute the difference between the two times in seconds, all in db: SELECT (CAST(stop_time AS SECONDS) + 86400 - CAST(start_time AS SECONDS)) % 86400; Unfortunately AS SECONDS causes parse error. Any hints? Thanks

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-10 Thread Alvaro Herrera
Tom Lane wrote: > Benjamin Arai <[EMAIL PROTECTED]> writes: > > Is there a specific exception code for: > > ERROR: no operand in tsearch query: "(" > > regression=# \set VERBOSITY verbose > regression=# select to_tsquery('('); > ERROR: 42601: no operand in tsearch query: "(" > LOCATION: gettoke

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Alvaro Herrera
Martijn van Oosterhout escribió: > The postgres function now() is the same: it returns a number of seconds. > Only when you actually go to display it does it do the localtime() > dance (internally) to make it look nice. That why you can set the > timezone to whatever you like and everything works

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread novnov
Yes, but there are still some parts of this I don't understand. From the application user's perspective, the datetime a record was last updated needs to be presented in their local time, in the browser. I have never been intimate with web apps that accomodate user profile time settings, but have u

Re: [GENERAL] Postgresql 7.3 on Red Hat Enterprise 5 (Problem with SEMMNI, SEMMNS)

2007-09-10 Thread Tom Lane
Darek Czarkowski <[EMAIL PROTECTED]> writes: > I am sorry, it seams that my last replay never reached the list. > I was looking for the list of changes for each version, but this document i= > s bundled with the source. I believe it is the fix introduced in version 7.= > 3.5: > "* Fix insertion of

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread Martijn van Oosterhout
On Mon, Sep 10, 2007 at 07:46:17AM -0700, novnov wrote: > But 'apps all know to adjust for TZ'; really? In this case I'm creating the > app, I can't imagine that it will automatically know to adjust for TZ? The > postgres function now() would output now as far as the server is concerned > (per it's

Re: [GENERAL] Time Zone design issues

2007-09-10 Thread novnov
Ha ha that's a funny and accurate way of putting it! I am deploying on a linux box, so it's good to know this. But 'apps all know to adjust for TZ'; really? In this case I'm creating the app, I can't imagine that it will automatically know to adjust for TZ? The postgres function now() would outpu

Re: [GENERAL] Alias "all fields"?

2007-09-10 Thread Stefan Schwarzer
Ouff thanks for all these replies. A reason for this kind of design yeah, I guess these here: a) not being a professional database designer b) import through Excel exports... that is, the QC, harmonization and aggregations are being done in Excel, and then the final result is being e

Re: [GENERAL] arrays of foreign keys

2007-09-10 Thread Josh Trutwin
On Fri, 07 Sep 2007 23:47:40 - Max <[EMAIL PROTECTED]> wrote: > Hello, > > And pardon me if I posted this question to the wrong list, it seems > this list is the most appropriate. > > I am trying to create a table with an array containing foreign keys. > I've searched through the documentati

Re: [GENERAL] audit sql queries

2007-09-10 Thread Richard Huxton
Dan99 wrote: Hello, I am working on auditing interactions with a pgsql database using php. So my question is how can i go about obtaining the following information by only being provided a pgsql query. I have asked this same question in a php group however i would also like to ask it here enca

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-10 Thread Tom Lane
Benjamin Arai <[EMAIL PROTECTED]> writes: > Is there a specific exception code for: > ERROR: no operand in tsearch query: "(" regression=# \set VERBOSITY verbose regression=# select to_tsquery('('); ERROR: 42601: no operand in tsearch query: "(" LOCATION: gettoken_query, tsquery.c:163 Seems to

Re: [GENERAL] arrays of foreign keys

2007-09-10 Thread Albe Laurenz
Max wrote: > I am trying to create a table with an array containing foreign keys. > I've searched through the documentation and couldn't find a way to do > so. > > Is this something that one can do? > > Basically, I have two tables: > > create table user ( > user_id serial, > login varchar(5

Re: [GENERAL] arrays of foreign keys

2007-09-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/07/07 18:47, Max wrote: > Hello, > > And pardon me if I posted this question to the wrong list, it seems > this list is the most appropriate. > > I am trying to create a table with an array containing foreign keys. > I've searched through the d

Re: [GENERAL] audit sql queries

2007-09-10 Thread Rodrigo De León
On 9/9/07, Dan99 <[EMAIL PROTECTED]> wrote: > Any help with this would be greatly appreciated. http://www.postgresql.org/docs/8.2/static/plpgsql-trigger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE ---(end of broadcast)--- TIP 4: Have you searched our list ar

Re: [GENERAL] arrays of foreign keys

2007-09-10 Thread Michael Glaesemann
On Sep 7, 2007, at 18:47 , Max wrote: I am trying to create a table with an array containing foreign keys. I've searched through the documentation and couldn't find a way to do so. It's because this is not how relational databases are designed to work. From the server's point of view, an ar

Re: [GENERAL] arrays of foreign keys

2007-09-10 Thread David Fetter
On Fri, Sep 07, 2007 at 11:47:40PM -, Max wrote: > Hello, > > And pardon me if I posted this question to the wrong list, it seems > this list is the most appropriate. > > I am trying to create a table with an array containing foreign keys. > I've searched through the documentation and couldn'

[GENERAL] audit sql queries

2007-09-10 Thread Dan99
Hello, I am working on auditing interactions with a pgsql database using php. So my question is how can i go about obtaining the following information by only being provided a pgsql query. I have asked this same question in a php group however i would also like to ask it here encase there is a w

Re: [GENERAL] Postgresql 7.3 on Red Hat Enterprise 5 (Problem with SEMMNI, SEMMNS)

2007-09-10 Thread Darek Czarkowski
I am sorry, it seams that my last replay never reached the list. I was looking for the list of changes for each version, but this document is bundled with the source. I believe it is the fix introduced in version 7.3.5: "* Fix insertion of expressions containing subqueries into rule bodies" Above

[GENERAL] archive_command with an environnement variable ?

2007-09-10 Thread Eric Pailleau
Dear all, In Postgresql documentation we have an example of the directive archive_command (for WAL) : archive_command = 'cp -i %p /mnt/server/directory_archive/%f

[GENERAL] arrays of foreign keys

2007-09-10 Thread Max
Hello, And pardon me if I posted this question to the wrong list, it seems this list is the most appropriate. I am trying to create a table with an array containing foreign keys. I've searched through the documentation and couldn't find a way to do so. Is this something that one can do? Basical

Re: [GENERAL] Getting result from EXECUTE

2007-09-10 Thread Pavel Stehule
Hello execute doesn't set FOUND variable, but sets diagnostics variables. you can: create table foo(a integer); insert into foo values(10),(20); create or replace function f() returns void as $$declare rc integer; begin execute 'update foo set a = a'; get diagnostics rc = row_count; raise notice

Re: [GENERAL] Regular expression on a string problem.

2007-09-10 Thread Albe Laurenz
Paul Mendoza wrote: > Sent: Saturday, September 08, 2007 12:53 AM > To: pgsql-general@postgresql.org > Subject: [GENERAL] Regular expression on a string problem. > > Here is a problem I'm having with a function I've created. It > should be returning a varchar value no matter what the input > is