[GENERAL] Providing user based previleges to Postgres DB

2007-04-11 Thread ramachandra.bhaskaram
Hi All, Currently in one of the projects we want to restrict the unauthorized users to the Postgres DB. Here we are using Postgres version 8.2.0 Can anybody tell me how can I provide the user based previleges to the Postgres DB so that, we can restrict the unauthorized users as well as porivde

[GENERAL] INSERT..RETURNING on a partitioned table

2007-04-11 Thread Leon Mergen
Hello, I'm attempting to convert a big table into smaller tables; I currently do a lot of INSERT .. RETURNING calls on the big table, which works perfectly. To convert the table into smaller tables, I have set up a test case of 3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1

Re: [GENERAL] Acces via applets

2007-04-11 Thread Luca Ferrari
On Wednesday 11 April 2007 Marc's cat, walking on the keyboard, wrote: > The bottom line question is can an applet served to a client machine other > than the one the postrgres db resides on read that db? > > An applet I've written and tested on the same box as my database runs fine. Marc's, due t

[GENERAL] INSERT..RETURNING on a partitioned table

2007-04-11 Thread Leon Mergen
Hello, I'm attempting to convert a big table into smaller tables; I currently do a lot of INSERT .. RETURNING calls on the big table, which works perfectly. To convert the table into smaller tables, I have set up a test case of 3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1

Re: [GENERAL] Unable to get a database connection while deleting rows

2007-04-11 Thread Damian C
Hello Poul, I can't advise specifically regarding your problem (I'm sure some one will chime in soon). I will offer some general advice regarding java and jdbc connections. You are probably already aware of this Typically connections between java and database take a relatively long time to e

[GENERAL] seeking: advice on reordering table

2007-04-11 Thread Jonathan Vanasco
I've drastically altered a few tables in a major schema change. because of this, some columns that i'd really like to be 'leftmost' are rightmost. can anyone suggest a good way to reorder the table ? everything that i can think of involves creating a new table which means I'd have to red

[GENERAL] digest data types?

2007-04-11 Thread Reece Hart
Does anyone have postgresql types for message digests, especially md5 and sha1? Obviously I could store these as text (as I currently do), but I'm particularly interested in custom types that store digests as binary blobs and provide conversion to/from text. Am I correct in assuming that the spac

Re: [GENERAL] newid() in postgres

2007-04-11 Thread Chris Fischer
Here's a PL/pgsql implementation I wrote.I'm sure critics will be able to improve upon it: CREATE or REPLACE FUNCTION "common"."newid"() RETURNS "pg_catalog"."varchar" AS $BODY$ DECLARE v_seed_value varchar(32); BEGIN select md5( inet_client_addr()::varchar || timeofday() || inet_server_ad

[GENERAL] hashtext () and collisions

2007-04-11 Thread Leon Mergen
Hello, Okay, I have some troubles trying to determine how to most efficiently store a database which will contain a couple of huge tables (think 5bil+ rows). These tables each have a bigint id and a character varying value. Now, I'm currently partitioning these tables based on the hashtext (value

[GENERAL] ERROR: XLogFlush request 0/240169BC is not satisfied

2007-04-11 Thread Nitin Verma
java.sql.SQLException: ERROR: XLogFlush: request 0/240169BC is not satisfied --- flushed only to 0/23FFC01C This error I was in the logs of a java process that was failing to get some data. But using psql I was able to connect and query all the data. Thus this may indicate some connection / state

[GENERAL] Unable to get a database connection while deleting rows

2007-04-11 Thread Poul Møller Hansen
I have a java application receiving data from a thousand devices on periodic basis. When receiving data the application gets a database connection, inserts a row and closes the connection again. If this process takes more than 15 seconds, the device assumes the connection dead and makes a new on

Re: [GENERAL] Acces via applets

2007-04-11 Thread Reid Thompson
Marc wrote: what version of PostgreSQL? what version of the jdbc driver? The bottom line question is can an applet served to a client machine other than the one the postrgres db resides on read that db? I can't see why not. An applet I’ve written and tested on the same box as my database

Re: [GENERAL] SQL - finding next date

2007-04-11 Thread Jon Sime
Raymond O'Donnell wrote: > This is probably a very simple one, but I just can't see the answer and > it's driving me nuts. I have a table holding details of academic terms, > and I need an SQL query such that for any given term I want to find the > next term by starting date (or just NULL if there

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Jan de Visser
On Wednesday 11 April 2007 14:01:55 Alberto Molteni wrote: > >You should use > > > >  conn.setAutoCommit(false); > >  conn.execute(...) > >  conn.execute(...) > >  conn.execute(...) > >  conn.commit(); > > > > > > Thanks! > > jan > > Then,  conn.setAutoCommit(false); has to be regarded as a begin s

Re: [GENERAL] Kill session in PostgreSQL

2007-04-11 Thread Ardian Xharra
You can use kill PID - Original Message - From: Ashish Karalkar To: pggeneral Sent: Tuesday, April 10, 2007 8:01 AM Subject: [GENERAL] Kill session in PostgreSQL Hello all, is there any command just like ORACLE Uses kill session to kill a particular session . tried wit

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread Leif B. Kristensen
On Wednesday 11. April 2007 19:50, Andrew Edson wrote: >I'm needing to do a partial dump on a database. All of the entries in > the db can be marked as one of two groups, and I've been asked to > create a dump of just the second group. It is possible to do a > select statement based dump and just

[GENERAL] table partitioning and plpgsql functions in 8.2.3

2007-04-11 Thread paul rivers
Overview: plpgsql functions seem to ignore partitioning, even with constraint_exclusion on. Description: Version is 8.2.3 on RHEL 4, constraint_exlusion is on. I have an events table (fw_events) partitioned by an int and a date (fw_id, fw_date for discussion) following the recommendations ou

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Jan de Visser
On Wednesday 11 April 2007 12:49:49 Albert wrote: > Hi all! > > Actually I have a client-server application with one server and many > clients each one of which opens a different connection to the postgres > database. In order to avoid those known problems with the execution of > the different clie

Re: [GENERAL] SQL - finding next date

2007-04-11 Thread Chris Fischer
You'll need to do something like this, called a correlated subquery: Select t1.term_id, t1.term_name, t1.term_starts, t2.term_id as next_term From term t1, term t2 where t2.term_starts = (select min(t3.term_starts) from term t3 where t3.term_starts > t1.term_starts) -Original Message- F

[GENERAL] hashtext & collisions

2007-04-11 Thread Leon Mergen
Hello, Okay, I have some troubles trying to determine how to most efficiently store a database which will contain a couple of huge tables (think 5bil+ rows). These tables each have a bigint id and a character varying value. Now, I'm currently partitioning these tables based on the hashtext (value

Re: [GENERAL] hashtext () and collisions

2007-04-11 Thread Andrew - Supernews
On 2007-04-11, "Leon Mergen" <[EMAIL PROTECTED]> wrote: > Now, my question is: how big is the chance that a collision happens > between hashes ? I noticed that the function only returns a 32 bit > number, so I figure it must be at least once in the 4 billion values. Assuming it's a uniform random

[GENERAL] hashtext () and collisions

2007-04-11 Thread Leon Mergen
Hello, Okay, I have some troubles trying to determine how to most efficiently store a database which will contain a couple of huge tables (think 5bil+ rows). These tables each have a bigint id and a character varying value. Now, I'm currently partitioning these tables based on the hashtext (value

Re: [GENERAL] Evaluate only one CASE WHEN in a select

2007-04-11 Thread Guy Rouillier
dcrespo wrote: Hi everybody, I'm implementing something like this: SELECT CASE WHEN add_numbers(t1.main_number,t2.main_number)>100 THEN t1.description1 ELSE t2.description1 END AS number_description1, CASE WHEN add_numbers(t1.main_number,t2.main_number)>100 T

Re: [GENERAL] 8.2.3 AutoVacuum not running

2007-04-11 Thread marcelo Cortez
Hi folks I Agree with Stephen ,before update to 8.2.3 version i can see "vacuum database xx " tailing the file log, off course log statements i'ts in 'all' . After update don't see anymore, plus pgAdmin reclaim to me for vacuum databases. best regards MDC --- "Schwenker, Stephen" <[EMAIL

[GENERAL] hashtext () and collisions

2007-04-11 Thread Leon Mergen
Hello, Okay, I have some troubles trying to determine how to most efficiently store a database which will contain a couple of huge tables (think 5bil+ rows). These tables each have a bigint id and a character varying value. Now, I'm currently partitioning these tables based on the hashtext (value

[GENERAL] INSERT..RETURNING on partitioned table

2007-04-11 Thread Leon Mergen
Hello, I'm attempting to convert a big table into smaller tables; I currently do a lot of INSERT .. RETURNING calls on the big table, which works perfectly. To convert the table into smaller tables, I have set up a test case of 3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1

Re: [GENERAL] SQL - finding next date

2007-04-11 Thread SCassidy
Is something like this too simple? select term_id from terms where term_id > 2 order by term_starts limit 1; or select term_id from terms where term_starts > '2007-09-01' order by term_starts limit 1; depending on whether you have the term_id or the term_starts date. Susan Cassidy Raymond O

[GENERAL] is there a way to determine the attributes of anyelement

2007-04-11 Thread chrisj
I have written a simple procedure that accepts anyarray, and concatinates the elements separated by a space and returns the result to anyelement. I know when I call this function I will always be passing varchars. If the length of the resultant concatination is longer than the maximum length of

Re: [GENERAL] What about SkyTools?

2007-04-11 Thread Robert Treat
On Wednesday 11 April 2007 12:08, Dmitry Koterov wrote: > Hello. > > Have anybody used SkyTools in production environment? > What's the impression? In practice - is it now more preferrable than Slony > or not yet? Well, skype using them in production... I think the general consensus of the post

[GENERAL] pg_standby: Unremovable Trigger File

2007-04-11 Thread Thomas F. O'Connell
I've been testing pg_standby as a helper application for a warm standby setup. So far, so good. When the environment is controlled and everything happens as expected, I'm able to operate a basic primary/standby setup. (This is all using 8.2.3 on Solaris x86, btw.) One thing I noticed in ear

Re: [GENERAL] SQL - finding next date

2007-04-11 Thread Jeffrey Melloy
On 4/11/07, Raymond O'Donnell <[EMAIL PROTECTED]> wrote: Hi all, This is probably a very simple one, but I just can't see the answer and it's driving me nuts. I have a table holding details of academic terms, and I need an SQL query such that for any given term I want to find the next term by s

Re: [GENERAL] Tomcat question/problem

2007-04-11 Thread Dhaval Shah
Check the URLs below. It might be what you are looking for: http://www.postgresql.org/communityfiles/27.pdf http://tomcat.apache.org/tomcat-5.5-doc/printer/jndi-datasource-examples-howto.html Dhaval On 4/9/07, Marc <[EMAIL PROTECTED]> wrote: Hi there. I've written an applet that connect

Re: [GENERAL] Select taking excessively long; Request help streamlining.

2007-04-11 Thread Tom Lane
Andrew Edson <[EMAIL PROTECTED]> writes: > A copy of the statement and explain results on it appear below. Would > someone please assist me in figuring out how to more appropriately streamline > this statement? The lack of any applicable index on ttrans seems to be the biggest problem.

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread Tom Lane
Andrew Edson <[EMAIL PROTECTED]> writes: > I am aware of this, yes, but the data in question is all (both sets) > contained on a single table. That's why I was looking for a way to do a > 'dump where (select foo where bar = 'criteria')' structure. pg_dump is not in the business of editorializin

[GENERAL] SQL - finding next date

2007-04-11 Thread Raymond O'Donnell
Hi all, This is probably a very simple one, but I just can't see the answer and it's driving me nuts. I have a table holding details of academic terms, and I need an SQL query such that for any given term I want to find the next term by starting date (or just NULL if there isn't one). Here's

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread John D. Burger
Andrew Edson wrote: I am aware of this, yes, but the data in question is all (both sets) contained on a single table. That's why I was looking for a way to do a 'dump where (select foo where bar = 'criteria')' structure. What if you do that select into a new table, then pg_dump just that

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread Andrew Edson
I am aware of this, yes, but the data in question is all (both sets) contained on a single table. That's why I was looking for a way to do a 'dump where (select foo where bar = 'criteria')' structure. Merlin Moncure <[EMAIL PROTECTED]> wrote: On 4/11/07, Andrew Edson wrote: > I'm needing to d

Re: [GENERAL] Acces via applets

2007-04-11 Thread Andrew Thompson
On Apr 11, 3:45 pm, [EMAIL PROTECTED] ("Marc") wrote: .. > The applet has been self signed. .. I did miss that bit on my initial reading, but like I said earlier - best to continue it in a discussion on a Java group. Andrew T. ---(end of broadcast)---

[GENERAL] Evaluate only one CASE WHEN in a select

2007-04-11 Thread dcrespo
Hi everybody, I'm implementing something like this: SELECT CASE WHEN add_numbers(t1.main_number,t2.main_number)>100 THEN t1.description1 ELSE t2.description1 END AS number_description1, CASE WHEN add_numbers(t1.main_number,t2.main_number)>100 THEN t1.descriptio

Re: [GENERAL] Acces via applets

2007-04-11 Thread Andrew Thompson
On Apr 11, 3:45 pm, [EMAIL PROTECTED] ("Marc") wrote: > The bottom line question is can an applet served to a client machine other > than the one the postrgres db resides on read that db? Certainly. But the applet needs to be signed by the distributor, and trusted by the end-user. > Why does an

Re: [GENERAL] 8.2.3 AutoVacuum not running

2007-04-11 Thread Schwenker, Stephen
It says it's on and I have also turned on all stats collecting. -Original Message- From: Alvaro Herrera [mailto:[EMAIL PROTECTED] Sent: Monday, April 09, 2007 3:06 PM To: Schwenker, Stephen Cc: Tom Lane; pgsql-general@postgresql.org Subject: Re: [GENERAL] 8.2.3 AutoVacuum not running S

Re: [GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread Merlin Moncure
On 4/11/07, Andrew Edson <[EMAIL PROTECTED]> wrote: I'm needing to do a partial dump on a database. All of the entries in the db can be marked as one of two groups, and I've been asked to create a dump of just the second group. It is possible to do a select statement based dump and just grab th

Re: [pgsql-www] [GENERAL] programmatic way to fetch latest release for a given major.minor version

2007-04-11 Thread Magnus Hagander
On Wed, Apr 11, 2007 at 06:49:18PM +0200, Listmail wrote: > > > >If someone wants the schema change, react *now*. Later on we can only > >append to it, and not change it :) > > Since I like to complain... > > > > Suppose you someday add another dot, or a "b" for beta, wouldn't it

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Alberto Molteni
You should use conn.setAutoCommit(false); conn.execute(...) conn.execute(...) conn.execute(...) conn.commit(); Thanks! jan Then, conn.setAutoCommit(false); has to be regarded as a begin statement? I had already put the autocommit flag to false soon after the creation of the connec

[GENERAL] Dumping part (not all) of the data in a database...methods?

2007-04-11 Thread Andrew Edson
I'm needing to do a partial dump on a database. All of the entries in the db can be marked as one of two groups, and I've been asked to create a dump of just the second group. It is possible to do a select statement based dump and just grab the one set of records in the output? ---

Re: [GENERAL] The rule question before, request official documentation on the problem

2007-04-11 Thread Martijn van Oosterhout
On Wed, Apr 11, 2007 at 09:21:46AM -0700, Chris Travers wrote: > DO ALSO rules involving NEW are fundamentally dangerous to the integrity > of data because NEW is not guaranteed to be internally consistent. DO > INSTEAD rules are fine (there is only one NEW), as are any DO ALSO rules > involvin

[GENERAL] indexes, and tables within tables

2007-04-11 Thread Jaime Silvela
I was reading an interview with Chris Date the other day, which got me thinking about a problem I'm currently having: I have an application that keeps information in 6 denormalized tables, D1 through D6. To tie things together, all these tables have a common column, let's call it obj_id. There

[GENERAL] Transactions through JDBC

2007-04-11 Thread Albert
Hi all! Actually I have a client-server application with one server and many clients each one of which opens a different connection to the postgres database. In order to avoid those known problems with the execution of the different clients' operations at database, I implemented everything in this

Re: [pgsql-www] [GENERAL] programmatic way to fetch latest release for a given major.minor version

2007-04-11 Thread Listmail
If someone wants the schema change, react *now*. Later on we can only append to it, and not change it :) Since I like to complain... Suppose you someday add another dot, or a "b" for beta, wouldn't it be better to have 823 ... or ---(end of b

Re: [pgsql-www] [GENERAL] programmatic way to fetch latest release for a given major.minor version

2007-04-11 Thread Magnus Hagander
On Tue, Apr 10, 2007 at 12:18:52PM +0200, Magnus Hagander wrote: > On Tue, Apr 10, 2007 at 09:52:52AM +0100, Dave Page wrote: > > Magnus Hagander wrote: > > > 2) Create a new file with a specific schema. Something like: > > > > > > > > > > > > > > > This is the most lightweight solution. > >

Re: [GENERAL] The rule question before, request official documentation on the problem

2007-04-11 Thread Chris Travers
Listmail wrote: Since we now have UPDATE/INSERT/DELETE RETURNING, one could imagine the rules using these to access the actual rows and not the expressions... But there is a perfectly valid argument against that : - There already is a mechanism designed specifically for this

[GENERAL] Select taking excessively long; Request help streamlining.

2007-04-11 Thread Andrew Edson
If this message has already appeared on the list, I apologize. My system tried to temporarily freeze up when I attempted to send this message a few minutes ago, and I do not know if I hit send before it halted or not. I am working with a php program that is designed to enter the database,

[GENERAL] What about SkyTools?

2007-04-11 Thread Dmitry Koterov
Hello. Have anybody used SkyTools in production environment? What's the impression? In practice - is it now more preferrable than Slony or not yet?

Re: [GENERAL] COPY FROM file with zero-delimited fields

2007-04-11 Thread Merlin Moncure
On 11 Apr 2007 00:25:50 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi all, I wonder if there's a way to use COPY FROM command when dealing with a data file containing records whose fields are delimited with zero- byte? Or I'd better change the delimiter? :) you can always run it throug

Re: [GENERAL] 8.2.3 AutoVacuum not running

2007-04-11 Thread Tom Lane
"Schwenker, Stephen" <[EMAIL PROTECTED]> writes: > It says it's on and I have also turned on all stats collecting. My guess is that it's actually running but is not choosing to do any vacuums for some reason. Try setting log_min_messages to DEBUG5 for awhile and trawling the postmaster log for ev

Re: [GENERAL] Do I need serializable for this query? -- Part 2

2007-04-11 Thread William Garrison
Should I just use a trigger to update these totals? That way concurrent deletes/updates would be guaranteed to update the totals. The only down side is that deleting 10 records would result in 10 updates to the totals. But deleting is rare enough that it probably isn't a problem. William Ga

[GENERAL] Do I need serializable for this query? -- Part 2

2007-04-11 Thread William Garrison
This is part 2 of my "serializable" question from earlier. Thanks to everyone who answered the first part. (Hopefully there will be no part 3) When a user adds a record, I update a table with totals. But when a user deletes data, I subtract the totals. That presents a more interesting situ

[GENERAL] ORDER BY with UNION

2007-04-11 Thread Niederland
Using Postgresql 8.2.3 The following query functions correctly: select lastname as name from person where lastname ='Smith' union select firstname as name from person where firstname = 'John' order by name; --- The followi

[GENERAL] COPY FROM file with zero-delimited fields

2007-04-11 Thread eugene . mindrov
Hi all, I wonder if there's a way to use COPY FROM command when dealing with a data file containing records whose fields are delimited with zero- byte? Or I'd better change the delimiter? :) ---(end of broadcast)--- TIP 4: Have you searched our list

[GENERAL] Acces via applets

2007-04-11 Thread Marc
The bottom line question is can an applet served to a client machine other than the one the postrgres db resides on read that db? An applet I've written and tested on the same box as my database runs fine. When I try running the applet from another computer on the network I get an error trying to

Re: [GENERAL] The rule question before, request official documentation on the problem

2007-04-11 Thread Listmail
Rules mess with queries. For data copying/archiving kinds of tasks, triggers are a better bet, like you suggested in your original post. Let me put that a different way: rules can *only* be used where data integrity is not at stake. My own thinking is that it might be time to make an officia

Re: [GENERAL] Do I need serializable for this query?

2007-04-11 Thread Michael Fuhr
On Tue, Apr 10, 2007 at 10:52:11PM +0200, Peter Eisentraut wrote: > William Garrison wrote: > > I have a table that keeps running totals. It is possible that this > > would get called twice simultaneously for the same UserID. Do I need > > to put this in a serializable transaction? > > Transacti

Re: [GENERAL] The rule question before, request official documentation on the problem

2007-04-11 Thread Stuart Cooper
I just came up with a far more problematic case too and wonder if documentation is enough. Maybe we should warn about potential problems more loudly. Imagine the following case: insert into test_table (test) values (random()) where an insert rule propagates the changes faithfully to the next

Re: [GENERAL] The rule question before, request official documentation on the problem

2007-04-11 Thread Chris Travers
Hmm. I just came up with a far more problematic case too and wonder if documentation is enough. Maybe we should warn about potential problems more loudly. Imagine the following case: insert into test_table (test) values (random()) where an insert rule propagates the changes faithfully