[GENERAL] How to use pg_stat_activity correctly ?

2006-02-10 Thread Luki Rustianto
Hi All, I try to query on pg_stat_activity but the returned result is only like this: teramedv2=> select * from pg_stat_activity where datname='teramedv2'; datid | datname | procpid | usesysid | usename | current_query | query_start ---+---+-+--+-+--

Re: [GENERAL] How to use pg_stat_activity correctly ?

2006-02-10 Thread A. Kretschmer
am 10.02.2006, um 15:30:02 +0700 mailte Luki Rustianto folgendes: > Hi All, > > I try to query on pg_stat_activity but the returned result is only like this: > > teramedv2=> select * from pg_stat_activity where datname='teramedv2'; > datid | datname | procpid | usesysid | usename | current_qu

[GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread James Harper
Is there anything I can do to make postgres allow an implicit cast of an empty string to a timestamp, so that a badly behaved application can do: INSERT INTO SomeTable (timestampfield) VALUES ('') Where timestampfield is of type typestamp. ? From what I understand of the 'CREATE CAST' command, I

Re: [GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread A. Kretschmer
am 10.02.2006, um 20:22:57 +1100 mailte James Harper folgendes: > Is there anything I can do to make postgres allow an implicit cast of an > empty string to a timestamp, so that a badly behaved application can do: test=# select * from t1; x - foo (2 rows) test=# select case when x='' the

Re: [GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread James Harper
> am 10.02.2006, um 20:22:57 +1100 mailte James Harper folgendes: > > Is there anything I can do to make postgres allow an implicit cast of an > > empty string to a timestamp, so that a badly behaved application can do: > > > INSERT INTO SomeTable (timestampfield) VALUES ('') > > You can't inser

Re: [GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread James Harper
How much trouble am I going to get into by modifying the pg_cast table to call my function instead? I created this function: CREATE OR REPLACE FUNCTION pg_catalog.mssql_timestamp (text) RETURNS timestamp LANGUAGE SQL AS $$ SELECT CASE WHEN $1 = '' THEN NULL ELSE pg_catalog.timestamp($1) END $$;

Re: [GENERAL] r trim of characters other than space

2006-02-10 Thread Pandurangan R S
You need to use two single quotes around ^ (like ''^'') or use the dollar quoting approach. http://www.postgresql.org/docs/8.1/static/plpgsql-development-tips.html On 2/10/06, surabhi.ahuja <[EMAIL PROTECTED]> wrote: > > > but how should i do it within a stored procedure > something like: > > C

[GENERAL] backslash separated values for a field

2006-02-10 Thread surabhi.ahuja
Hi,    i have a field "x" which can be of the form   abc\def\123   i.e. they are back slash separated fields   is there any operator in postgres which can process a query like give me all xs where x is abc   is ther any opeartor like contain, so i can form a query of the form:   select * from

Re: [GENERAL] backslash separated values for a field

2006-02-10 Thread Leif B. Kristensen
On Friday 10 February 2006 12:54, surabhi.ahuja wrote: >is ther any opeartor like contain, so i can form a query of the form: > >select * from table_name where x contains 'abc'; SELECT * FROM table_name WHERE x LIKE '%abc%'; You should probably avoid using backslash as a separator because of its

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-10 Thread Doug McNaught
Bruno Wolff III <[EMAIL PROTECTED]> writes: > On Tue, Feb 07, 2006 at 15:28:31 +0300, > Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: >> The real situation would be as the following. >> I want to use some algorithm to hide real number of registered users >> in my table user. So, I don't want to

[GENERAL] Dropping a database that does not exist

2006-02-10 Thread Tham Shiming
Hi, I've been getting duplicate databases within my server. Dropping one of them works, but when I try to drop the other, psql will say that the database does not exist. For example: db1 db1 db2 db3 db4 db4 db5 Running DROP DATABASE db1 for the first time works and I'm left with: db1 db2 d

Re: [GENERAL] Database Comparison tool?

2006-02-10 Thread Tom Lane
[ please refrain from top-quoting, and try not to repeat the entire previous post; we do have archives you know ] Rick Gigger <[EMAIL PROTECTED]> writes: > On Feb 9, 2006, at 1:03 PM, Philippe Ferreira wrote: >> Do a "pgdump" of both databases, and use the "diff" tool to compare >> the two gen

Re: [GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread Tom Lane
"James Harper" <[EMAIL PROTECTED]> writes: > How much trouble am I going to get into by modifying the pg_cast table > to call my function instead? You can doubtless hack it to work if you slash-and-burn hard enough. The question is why don't you fix your buggy application instead ...

Re: [GENERAL] Dropping a database that does not exist

2006-02-10 Thread Tom Lane
Tham Shiming <[EMAIL PROTECTED]> writes: > I've been getting duplicate databases within my server. What exactly makes you think you have that? regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your f

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Tony Wasson
On 2/9/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: > On Fri, Feb 10, 2006 at 11:30:04AM +0700, Luki Rustianto wrote: > > So how can we terminate such a long running query ? > > > > The idea is to make a crontab to periodicaly do a job to search a > > typical "SELECT * FROM bigtable" query who has r

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Dave Page
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tony Wasson > Sent: 10 February 2006 15:31 > To: Michael Fuhr > Cc: Luki Rustianto; Merlin Moncure; pgsql-general@postgresql.org > Subject: Re: [GENERAL] Is there a way to limit CPU usage per user >

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 09:31, Tony Wasson wrote: > On 2/9/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 10, 2006 at 11:30:04AM +0700, Luki Rustianto wrote: > > > So how can we terminate such a long running query ? > > > > > > The idea is to make a crontab to periodicaly do a job to sea

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Tom Lane
Tony Wasson <[EMAIL PROTECTED]> writes: > I am also interested in being able to terminate *certain* long running > queries. I didn't want to use statement_timeout because there are some > queries that must run for a long time - in our case some queries that > create summary tables. Other long runni

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Csaba Nagy
> You do know that statement_timeout can be changed freely via SET, > right? One way to attack this would be for the clients that are > issuing known long-running queries to do "SET statement_timeout" > to boost up their allowed runtime. How does this apply to autovacuum's long running vacuum com

Re: [GENERAL] Is there a way to limit CPU usage per user

2006-02-10 Thread Tom Lane
Csaba Nagy <[EMAIL PROTECTED]> writes: > How does this apply to autovacuum's long running vacuum commands ? Cause > I have one table where the last vacuum took 15 hours :-) [ Checks code... ] No, statement_timeout only applies to commands arriving from an interactive client. This *would* be a ha

[GENERAL] Tool

2006-02-10 Thread Bob Pawley
I am developing a database which needs testing prior to developing the host program.   I am looking for an easy-to-learn tool. I want to develop an interface that I can use to enter and display information in a similar fashion to how a user would operate the database.   A GUI tool would be i

Re: [GENERAL] Tool

2006-02-10 Thread Philippe Ferreira
I am developing a database which needs testing prior to developing the host program. I am looking for an easy-to-learn tool. I want to develop an interface that I can use to enter and display information in a similar fashion to how a user would operate the database. A GUI tool would be ide

Re: [GENERAL] Dropping a database that does not exist

2006-02-10 Thread Uwe C. Schroeder
I don't think you have duplicate databases - that would be the first time I heard that postgreSQL supports that. Are you sure you didn't create the database with a name that just doesn't print? I.e. a simple createdb test works. do another createdb "test " (note the space) works too, but when

[GENERAL]

2006-02-10 Thread Jean-Christophe Roux
Hello,I have a table with and id field (primary key) which default value is the result of a sequence (increment explicitly set to 1). To my surprise, the real increment on insert is the total number of rows of the table. For instance, with 41 rows and a sequence last_value of 1141, the next insert

Re: [GENERAL] Tool

2006-02-10 Thread Bob Pawley
Thanks I am using pgadmin for development. I'm looking for a tool with which I can develop an interface that will be used for entering and accessing information in context with the user tasks. Bob - Original Message - From: "Philippe Ferreira" <[EMAIL PROTECTED]> To: "Bob Pawley" <[

[GENERAL] Sequence skipping values

2006-02-10 Thread Jean-Christophe Roux
Hello,I have a table with and id field (primary key) which default value is the result of a sequence (increment explicitly set to 1). To my surprise, the real increment on insert is the total number of rows of the table. For instance, with 41 rows and a sequence last_value of 1141, the next inse

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Csaba Nagy
You likely roll back some transactions which insert. The sequence values don't get rolled back, once allocated, it's gone, even if you won't keep it. For concurrency/performance reasons sequence values are not transactional. Cheers, Csaba. On Fri, 2006-02-10 at 18:44, Jean-Christophe Roux wrote:

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 11:44, Jean-Christophe Roux wrote: > Hello, > I have a table with and id field (primary key) which default value is > the result of a sequence (increment explicitly set to 1). > To my surprise, the real increment on insert is the total number of > rows of the table. For insta

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Steve Crawford
Jean-Christophe Roux wrote: Hello, I have a table with and id field (primary key) which default value is the result of a sequence (increment explicitly set to 1). To my surprise, the real increment on insert is the total number of rows of the table. For instance, with 41 rows and a sequence l

Re: [GENERAL] Tool

2006-02-10 Thread Bob Pawley
This looks quite interseting.   Thanks Wes   Bob - Original Message - From: Wes Williams To: 'Bob Pawley' ; 'Postgresql' Sent: Friday, February 10, 2006 9:14 AM Subject: RE: [GENERAL] Tool You may wish to consider creating a web interface GUI.    For exam

Re: [GENERAL] distinct not working in a multiple join

2006-02-10 Thread David Rio Deiros
On Thu, Feb 09, 2006 at 09:51:13PM -0500, Stephen Frost wrote: > * David Rio Deiros ([EMAIL PROTECTED]) wrote: > > Now I have to redefine my query because I want to get the second > > output but keeping the group_id. Ideas and suggestions are welcome. > > You might want to look at 'distinct on'.

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 09:57:31AM -0800, Steve Crawford wrote: > There is no guarantee that a sequence will be contiguous. For example, > begin...insert into...rollback will not reset the sequence as other > transactions could have incremented the sequence. Also, deleting records won't modify

Re: [GENERAL] Tool

2006-02-10 Thread Tony Caduto
I am developing a database which needs testing prior to developing the host program. I am looking for an easy-to-learn tool. I want to develop an interface that I can use to enter and display information in a similar fashion to how a user would operate the database. A GUI tool would be

Re: [GENERAL] Tool

2006-02-10 Thread Bob Pawley
Thanks very much Tony. I'll give it a go. Bob - Original Message - From: "Tony Caduto" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Friday, February 10, 2006 11:42 AM Subject: Re: [GENERAL] Tool I am developing a database which needs testing prior to developing the host progra

Re: [GENERAL] Tool

2006-02-10 Thread Jonel Rienton
EMS' Postgresql Manager Lite is also pretty intuitive. http://www.sqlmanager.net/products/postgresql/manager/download -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bob Pawley Sent: Friday, February 10, 2006 1:49 PM To: Tony Caduto Cc: Postgresql Subje

Re: [GENERAL] Tool

2006-02-10 Thread Philippe Ferreira
Thanks I am using pgadmin for development. I'm looking for a tool with which I can develop an interface that will be used for entering and accessing information in context with the user tasks. Bob Hi, Why not OpenOffice "Base" ? http://www.openoffice.org/product/base.html Philippe Fer

[GENERAL] Limiting with a left outer join

2006-02-10 Thread Bill Moseley
I've been staring at this too long. Could someone give me a bit of sql help? I want to show a list of upcoming workshops, and the number of sessions (classes) offered for each workshop: workshop_id | classes_offered | review_mode | workshop_cat -+-+-

Re: [Bulk] Re: [GENERAL] Tool

2006-02-10 Thread Ted Byers
Bob,   If you're interested in a free java tool, you might want to look at NetBeans (now version 5).  It is one of the best I have seen, and I have used a wide variety of such tools in a number of different programming languages.  Understand, though, that you have a wide variety of options,

Re: [GENERAL] Dropping a database that does not exist

2006-02-10 Thread Tom Lane
"Uwe C. Schroeder" <[EMAIL PROTECTED]> writes: > I don't think you have duplicate databases - that would be the first time I > heard that postgreSQL supports that. > Are you sure you didn't create the database with a name that just doesn't > print? That's one possibility that I was wondering abo

Re: [GENERAL] Tool

2006-02-10 Thread Emi Lu
Could you suggests some tools that do not have to be super users to install it under Linux ? - Emi Thanks I am using pgadmin for development. I'm looking for a tool with which I can develop an interface that will be used for entering and accessing information in context with the user tasks.

Re: [GENERAL] Sequences/defaults and pg_dump

2006-02-10 Thread Bruno Wolff III
On Fri, Feb 10, 2006 at 07:34:35 -0500, Doug McNaught <[EMAIL PROTECTED]> wrote: > Bruno Wolff III <[EMAIL PROTECTED]> writes: > > Or, just start your sequence counting at 100. Or use bigint and > start it at a billion. That may work if you only have access to one id number, but you don't

Re: [GENERAL] Tool

2006-02-10 Thread Tino Wildenhain
Philippe Ferreira schrieb: > >> Thanks I am using pgadmin for development. I'm looking for a tool with >> which I can develop an interface that will be used for entering and >> accessing information in context with the user tasks. >> >> Bob > > > Hi, > > Why not OpenOffice "Base" ? Someone sho

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Jean-Christophe Roux
Hi,Thanks four your answers. Let me give more details here.The table with the id not incrementing by 1 as I expected is named topics.I have three other tables that contain rules that on insert into those tables, some fields of the table Topic should be updated.Each of those three tables contain

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Steve Crawford
Jean-Christophe Roux wrote: Hi, Thanks four your answers. Let me give more details here. The table with the id not incrementing by 1 as I expected is named topics. I have three other tables that contain rules that on insert into those tables, some fields of the table Topic should be updated. Eac

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 03:27:23PM -0800, Jean-Christophe Roux wrote: > The table with the id not incrementing by 1 as I expected is named topics. > > I have three other tables that contain rules that on insert into those > tables, some fields of the table Topic should be updated. > Each of th

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Jean-Christophe Roux
Hi here are the structures of the table involved:CREATE TABLE topics(  topic_id int8 NOT NULL DEFAULT nextval('topics_id_seq'::text),  datetime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone,  topic text NOT NULL,  administrator_id int8 NOT NULL,  status_id int8 DEFAULT 0,  l

[GENERAL] Return types of a function

2006-02-10 Thread Nalin Bakshi
Hi!    I have postgres installed in my machine and have a simple task to do. Step1) Fetch all the tables in the Database with name staerting with "AA" Step2) On each table you get fire a simple SQL query:     select * from ; Step3) Right these into a flat file. I have to carry out all t

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 08:10:36PM -0800, Jean-Christophe Roux wrote: > here are the structures of the table involved: I couldn't duplicate the problem in 8.1.2 or 8.0.6 with the code you posted. I created the given tables and rules (plus guesses for the administrators and status_list tables), th

Re: [GENERAL] Limiting with a left outer join

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 11:59:30AM -0800, Bill Moseley wrote: > How do I make a join on the class table but not effect the left outer > join? Are you looking for something like this? LEFT OUTER JOIN (class INNER JOIN class_domain ON ...) c ON ... -- Michael Fuhr ---(end