Re: [GENERAL] two or more pg installations running as the same user

2008-11-26 Thread Grzegorz Jaśkiewicz
2008/11/26 Mikko Partio <[EMAIL PROTECTED]> > You know you don't need separate clusters (ie. installations) to have > multiple databases? > obvioiusly. so far I just do: mkdir $INST export PGDATA=$INST export PGPORT=$INSTPORT initdb pg_ctl start .. and that's it folks. -- GJ

Re: [GENERAL] Postgres 8.3 only uses seq scan

2008-11-26 Thread Clemens Schwaighofer
On 11/26/2008 06:44 PM, [EMAIL PROTECTED] wrote: > Try running EXPLAIN ANALYZE - that gives much more information. For > example it may show differences in number of rows between the two > machines, that the statistics are not up to date, etc. Thanks a lot for this tip -- [ Clemens Schwaighofer

Re: [GENERAL] slow, long-running 'commit prepared'

2008-11-26 Thread Tom Lane
"John Smith" <[EMAIL PROTECTED]> writes: > I have a pg instance with 700GB of data, almost all of which is in one > table. When I PREPARE and then COMMIT PREPARED a transaction that > reads & writes to a large fraction of that data (about 10%, > effectively randomly chosen rows and so every file in

[GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Ivan Sergio Borgonovo
I've case when ''=extinput then null else extinput::timestamp end now when extinput='' it seems that else extinput::timestamp get evaluated anyway and I get: invalid input syntax for type timestamp: "" The purpose of all this gymnic would be to convert empty string to null and everything else t

Re: [GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Tom Lane
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > I've > case when ''=extinput then null else extinput::timestamp end > now when extinput='' it seems that else extinput::timestamp get > evaluated anyway and I get: > invalid input syntax for type timestamp: "" I think you are leaving off a large

Re: [GENERAL] Postgres 8.3 only uses seq scan

2008-11-26 Thread tv
Try running EXPLAIN ANALYZE - that gives much more information. For example it may show differences in number of rows between the two machines, that the statistics are not up to date, etc. regards Tomas > Hi, > > I have system here with Debian/Testing and the latest 8.2 and 8.3 > database install

Re: [GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Sam Mason
On Wed, Nov 26, 2008 at 02:53:07PM +0100, Ivan Sergio Borgonovo wrote: > case when ''=extinput then null else extinput::timestamp end I'd tend to use nullif(extinput,'')::timestamp for this sort of thing. It's not going to do anything much different from what you're doing, but may end up evaluatin

[GENERAL] Problem with langage encoding

2008-11-26 Thread Ronald Vyhmeister
I've inherited a database system (including source)... It's Russian text (which I don't speak, but I need to work on it). On my screen it shows correctly, but in the database it shows a mess... from trying with a web browser. It appears that the data in the database is encoded with ISO-8859-1

Re: [GENERAL] Effect of stopped status collector process

2008-11-26 Thread Alvaro Herrera
Merlin Moncure escribió: > On Tue, Nov 25, 2008 at 9:03 AM, Alvaro Herrera > <[EMAIL PROTECTED]> wrote: > > Why do we _have_ to write the file to disk? I wonder if it would work > > to store the file in a mmaped memory region and have the readers get > > data from there. We could have more than

Re: [GENERAL] Problem with langage encoding

2008-11-26 Thread Raymond O'Donnell
On 26/11/2008 14:40, Ronald Vyhmeister wrote: > The problem is that the database is UTF8, and it won't let me use the > convert_to function because it says that the characters don't exist... What > I need to do is to pull the UTF8 from the database, tell postgres that it's > 8859-1, and then conve

Re: [GENERAL] Problem with langage encoding

2008-11-26 Thread Ronald Vyhmeister
> The problem is that the database is UTF8, and it won't let me use the > convert_to function because it says that the characters don't exist... What > I need to do is to pull the UTF8 from the database, tell postgres that it's > 8859-1, and then convert it to WIN1251... How? >If the DB is in

Re: [GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Ivan Sergio Borgonovo
On Wed, 26 Nov 2008 14:18:44 + Sam Mason <[EMAIL PROTECTED]> wrote: > On Wed, Nov 26, 2008 at 02:53:07PM +0100, Ivan Sergio Borgonovo > wrote: > > case when ''=extinput then null else extinput::timestamp end > > I'd tend to use nullif(extinput,'')::timestamp for this sort of Thanks it was on

Re: [GENERAL] Problem with langage encoding

2008-11-26 Thread Tom Lane
"Ronald Vyhmeister" <[EMAIL PROTECTED]> writes: > The DB is storing it UTF8, but it is really 8859-1... I need to force PG to > think that it's 8859-1 in spite of what it thinks it may be... Dump the database, change the "set client_encoding" command in the resulting file, reload.

Re: [GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Sam Mason
On Wed, Nov 26, 2008 at 04:17:40PM +0100, Ivan Sergio Borgonovo wrote: > as a more self contained example: > > select case when ''='' then null else ''::timestamp end; Tee hee, I've just realized what you're doing. You've got the cast in the wrong place! Try: select case when ''='' then null

Re: [GENERAL] case when evaluating else condition anyway?

2008-11-26 Thread Tom Lane
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > Still why does the else condition get evaluated anyway when at least > one of the "when" condition is true? Because 'literal'::type is a literal of that type; it does not represent a run-time conversion. I think we document that under the discus

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Jeff MacDonald
On 25-Nov-08, at 10:44 AM, Tom Lane wrote: Jeff MacDonald <[EMAIL PROTECTED]> writes: The issue, is that when I run pg_get_serial_sequence on a particular table/column it returns NULL. Does the column actually own that sequence? Or is its default just something that was inserted manually?

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Jeff MacDonald
On 25-Nov-08, at 10:51 AM, V S P wrote: Did you first insert into public.news_status insert into public.news_status (status_id) values (DEFAULT) and then get the sequence? Hi VSP I'm not sure what relevance this has, a sequence already exists whether you insert into it or not. Just som

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Alvaro Herrera
Jeff MacDonald wrote: > Hi Tom, so far as I know the table "owns" the serial in so much as when i > do a \d of the table it says this > > status_id | integer | not null default > nextval('status_status_id_seq'::regclass) > > How else can I check? He means ALTER SEQUENCE ... O

Re: [GENERAL] [ADMIN] PgAgent Job Scehduler is NOT running

2008-11-26 Thread Vishal Arora
Try to follow the steps given in following link - http://wiki.postgresql.org/wiki/Image:PgAgent_for_windows.doc Date: Tue, 25 Nov 2008 02:32:46 -0800From: [EMAIL PROTECTED]: Re: [ADMIN] PgAgent Job Scehduler is NOT runningTo: [EMAIL PROTECTED]; [EMAIL PROTECTED]: pgsql-general@postgresql.org

Re: [GENERAL] Problem with langage encoding

2008-11-26 Thread Craig Ringer
Ronald Vyhmeister wrote: > >> The problem is that the database is UTF8, and it won't let me use the >> convert_to function because it says that the characters don't exist... > What >> I need to do is to pull the UTF8 from the database, tell postgres that > it's >> 8859-1, and then convert it to WI

[GENERAL] Odd on-update inconsistency

2008-11-26 Thread Steve Crawford
I'm having trouble understanding something I saw in my data from yesterday involving an inconsistency between values in a table and its associated rule-updated log table. For application debugging purposes (effectiveness of web double-submit suppression) we have a rule that creates an entry in

[GENERAL] Date math question

2008-11-26 Thread Kevin Kempter
Hi All; I have a table that contains 2 columns ts (a timestamp) and dursec (a float - number of seconds) I want to insert the following into another table: the ts (timestamp column) and a second date which is ts + dursec I tried these select variations with no luck: select ts, ts + interval d

Re: [GENERAL] Date math question

2008-11-26 Thread hubert depesz lubaczewski
On Wed, Nov 26, 2008 at 11:54:33AM -0700, Kevin Kempter wrote: > select ts, ts + interval dursec seconds from tmp2 limit 1; > select ts, ts + 'seconds' dursec from tmp2 limit 1; select ts, ts + dursec * '1 second'::interval ... depesz -- Linkedin: http://www.linkedin.com/in/depesz / blog: htt

Re: [GENERAL] Date math question

2008-11-26 Thread Raymond O'Donnell
On 26/11/2008 18:54, Kevin Kempter wrote: > I have a table that contains 2 columns ts (a timestamp) and dursec (a float - > number of seconds) > > I want to insert the following into another table: > > the ts (timestamp column) and a second date which is ts + dursec Something like this? - sel

Re: [GENERAL] Odd on-update inconsistency

2008-11-26 Thread Richard Huxton
Steve Crawford wrote: > I'm having trouble understanding something I saw in my data from > yesterday involving an inconsistency between values in a table and its > associated rule-updated log table. > > For application debugging purposes (effectiveness of web double-submit > suppression) we have a

[GENERAL] Order by question

2008-11-26 Thread Kevin Kempter
Hi All; I'm selecting 3 columns. I want to order the results ascending by col1 and col2 and then descending by col3 Whats the syntax for this? Thanks in advance -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.

Re: [GENERAL] Order by question

2008-11-26 Thread Grzegorz Jaśkiewicz
On Wed, Nov 26, 2008 at 7:46 PM, Kevin Kempter <[EMAIL PROTECTED]>wrote: > Hi All; > > I'm selecting 3 columns. I want to order the results ascending by col1 and > col2 and then descending by col3 > > Whats the syntax for this? > select * from foo order by a,b asc, c desc; ? -- GJ

Re: [GENERAL] Order by question

2008-11-26 Thread Andreas Kretschmer
Kevin Kempter <[EMAIL PROTECTED]> schrieb: > Hi All; > > I'm selecting 3 columns. I want to order the results ascending by col1 and > col2 and then descending by col3 > > Whats the syntax for this? order by col1 asc, col2 asc, col3 desc; Andreas -- Really, I'm not out to destroy Microsoft.

Re: [GENERAL] Order by question

2008-11-26 Thread Thomas Kellerer
Kevin Kempter wrote on 26.11.2008 20:46: Hi All; I'm selecting 3 columns. I want to order the results ascending by col1 and col2 and then descending by col3 Whats the syntax for this? ORDER BY col1 ASC, col2 ASC, col3 DESC this is documented in the manual -- Sent via pgsql-general maili

[GENERAL] problems with special characters

2008-11-26 Thread Karina Guardado
Hi list, I have a problem I have created a database with encoding SQL_ASCII and when I insert the data using a terminal in linux and insert the data for example Insert into mytable values(1,'Eléctrico'); it works fine but if I try to copy this data from a text file doing \copy mytable from tex

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Jeff MacDonald wrote: >> Hi Tom, so far as I know the table "owns" the serial in so much as when i >> do a \d of the table it says this > He means ALTER SEQUENCE ... OWNED BY > I don't know how you can ensure that it is, short of Well, actually, I thi

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Jaime Casanova
On Wed, Nov 26, 2008 at 3:53 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: >> Jeff MacDonald wrote: >>> Hi Tom, so far as I know the table "owns" the serial in so much as when i >>> do a \d of the table it says this > can we make \d show if the sequence is ow

Re: [GENERAL] Odd on-update inconsistency

2008-11-26 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Steve Crawford wrote: >> I'm having trouble understanding something I saw in my data from >> yesterday involving an inconsistency between values in a table and its >> associated rule-updated log table. >> >> For application debugging purposes (effective

[GENERAL] Date math question

2008-11-26 Thread Kevin Kempter
Hi All; I have a table that contains 2 columns ts (a timestamp) and dursec (a float - number of seconds) I want to insert the following into another table: the ts (timestamp column) and a second date which is ts + dursec I tried these select variations with no luck: select ts, ts + interval d

Re: [GENERAL] pg_get_serial_sequence Strangeness/Unreliable?

2008-11-26 Thread Alvaro Herrera
Jaime Casanova wrote: > can we make \d show if the sequence is owned by the table (ie: serial > or manually created and owned) or is a manually created and maked > default sequence? maybe a flag? My thought as well -- Alvaro Herrerahttp://www.CommandPrompt.com/

Re: [GENERAL] Odd on-update inconsistency

2008-11-26 Thread Steve Crawford
Richard Huxton wrote: Steve Crawford wrote: I'm having trouble understanding something I saw in my data from yesterday involving an inconsistency between values in a table and its associated rule-updated log table. For application debugging purposes (effectiveness of web double-submit suppre

Re: [GENERAL] Date math question

2008-11-26 Thread Steve Crawford
Kevin Kempter wrote: Hi All; I have a table that contains 2 columns ts (a timestamp) and dursec (a float - number of seconds) I want to insert the following into another table: the ts (timestamp column) and a second date which is ts + dursec I tried these select variations with no luck: se

[GENERAL] Group by clause creating "ERROR: wrong record type supplied in RETURN NEXT" (version 8.1.11 -- grr...)

2008-11-26 Thread Webb Sprague
Hi all, If I try to execute a dynamic query inside a function with a group by statement, returning a setof, I get a weird error. It may be due to the antiquated database version, but I would appreciate all the info I can get (I tried looking in the PG bug tracker, but ... hahaha). If it is as s

[GENERAL] query evaluation

2008-11-26 Thread Ravi Chemudugunta
Hi all, I have the following query. select part_id, consume_part(part_id) from part where in_use = false; does it: a/ iterate over all parts, calling consume on them and then show the records where in_use is false (i.e. all parts have been consumed by the SP consume_part) or b/ filter

Re: [GENERAL] Group by clause creating "ERROR: wrong record type supplied in RETURN NEXT" (version 8.1.11 -- grr...)

2008-11-26 Thread Klint Gore
Webb Sprague wrote: select * from mkn.query_table_data ('select sum(p087001) as pop from datatable_00040 group by substr(geo_id, 13, 6) order by pop desc limit 10') as FOO (pop integer); ERROR: wrong record type supplied in RETURN NEXT CONTEXT: PL/pgSQL function "query_table_data"

Re: [GENERAL] query evaluation

2008-11-26 Thread Scott Marlowe
On Wed, Nov 26, 2008 at 6:36 PM, Ravi Chemudugunta <[EMAIL PROTECTED]> wrote: > Hi all, > > I have the following query. > > select part_id, consume_part(part_id) from part where in_use = false; > > does it: > a/ iterate over all parts, calling consume on them and then show the > records where

Re: [GENERAL] [ADMIN] PgAgent Job Scehduler is NOT running

2008-11-26 Thread Abdul Rahman
Thanks Vishal, I followed the document and now the statistics of the job is appearing and showing successful but actually backup is not made via this job. In output tab it gives the following error: could not open the file "D:\xxx.backup":Permission denied. I tried to perform the task from bot