[GENERAL] protect a database

2007-07-18 Thread Zlatko Matić
Hello. Is there any way to hide database structure (at least functions and triggers) from a superuser/administrator? Regards, Zlatko

Re: [GENERAL] protect a database

2007-07-18 Thread Richard Huxton
Zlatko Matić wrote: Hello. Is there any way to hide database structure (at least functions and triggers) from a superuser/administrator? No. Otherwise they can't be an administrator. -- Richard Huxton Archonet Ltd ---(end of broadcast)---

Re: [GENERAL] why postgresql over other RDBMS

2007-07-18 Thread Naz Gassiep
Surely such a use case could, and more to the point *should* be met using PITR? Regards, - Naz. Alvaro Herrera wrote: A.M. wrote: On May 24, 2007, at 14:29 , Wiebe Cazemier wrote: On Thursday 24 May 2007 17:30, Alexander Staubo wrote: [2] Nobody else has this, I believe,

[GENERAL] redirecting output of pg_dump

2007-07-18 Thread Ashish Karalkar
Hello all, I want to take backup from one server and save it to another machine hard drive. The backup will be taken through a shell script attached to a cron job. something like: pg_dump -d postgres -U postgres -f IP address of other machine and path to save the file on that machine is

Re: [GENERAL] redirecting output of pg_dump

2007-07-18 Thread Joshua N Pritikin
On Wed, Jul 18, 2007 at 03:39:01PM +0530, Ashish Karalkar wrote: I want to take backup from one server and save it to another machine hard drive. The backup will be taken through a shell script attached to a cron job. something like: pg_dump -d postgres -U postgres -f IP address of

Re: [GENERAL] redirecting output of pg_dump

2007-07-18 Thread A. Kretschmer
am Wed, dem 18.07.2007, um 15:39:01 +0530 mailte Ashish Karalkar folgendes: Hello all, I want to take backup from one server and save it to another machine hard drive. The backup will be taken through a shell script attached to a cron job. something like: pg_dump -d postgres -U

Re: [GENERAL] unconvertable characters

2007-07-18 Thread Sim Zacks
I fixed my data, but I did it manually. It seems like there were hidden characters, which may actually be the 0xc2 (which should not have been there. The data must have been pasted in somehow, but when I copied the value and pasted it back in (or ran an update statement, I tried both) the same

Re: [GENERAL] redirecting output of pg_dump

2007-07-18 Thread Jayakumar_Mukundaraju
Hello ALL, I need one more help also... I already connected two systems (one is server that is ip address of 172.16.84.76/32, another is like a client 172.16.85.243/32) this connection is working fine... now i want to connect one more system in to that server (172.16.84.76/32) The new

[GENERAL] it works, but is it legal to separate schema/table/field references using spaces

2007-07-18 Thread Frank van Vugt
Hi, Just something I noticed to 'simply work': db=# select avg(pg_catalog. pg_stats . avg_width) from pg_stats; avg - 10.6654945054945055 (1 row) It seems that all whitespace between schema/table/field references is ignored? Not saying this is a bad

[GENERAL] REQUEST: option to auto-generate new sequences with CREATE TABLE (LIKE)

2007-07-18 Thread Nico Sabbi
Hi, as the subjects reads I searched in the docs a way to instruct postgres to create new sequences when copying tables containing serial columns, but the resulting serial fields in the new tables reference the original sequence. Yes, there are workarounds, but having an option to make

[GENERAL] Can't SELECT from (INSERT ... RETURNING)

2007-07-18 Thread Nico Sabbi
I thought I could use the output of INSERT...RETURNING as a set of tuples for a subquery, but it seems it's not the case: nb1=# select * from (insert into m(a) values(112) returning a); ERROR: syntax error at or near into LINE 1: select * from (insert into m(a) values(112) returni...

Re: [GENERAL] REQUEST: option to auto-generate new sequences with CREATE TABLE (LIKE)

2007-07-18 Thread David Fetter
On Wed, Jul 18, 2007 at 03:10:30PM +0200, Nico Sabbi wrote: Hi, as the subjects reads I searched in the docs a way to instruct postgres to create new sequences when copying tables containing serial columns, but the resulting serial fields in the new tables reference the original sequence.

[GENERAL] Again about varchar()

2007-07-18 Thread 李彦 Ian Li
Hi all: I have tables with one or several varchar(n) columns(utf8, n=200) which I believe those tables' row length will not exceed the page length. Will it helps to the performance that I turn off TOAST of those 'short' varchar() columns by issuing “ALTER TABLE foo ALTER COLUMN bar SET

Re: [GENERAL] Again about varchar()

2007-07-18 Thread Tom Lane
=?UTF-8?B?5p2O5b2mIElhbiBMaQ==?= [EMAIL PROTECTED] writes: I have tables with one or several varchar(n) columns(utf8, n=200) which I believe those tables' row length will not exceed the page length. Will it helps to the performance that I turn off TOAST of those 'short' varchar() columns by

Re: [GENERAL] [PERFORM] Parrallel query execution for UNION ALL Queries

2007-07-18 Thread Jonah H. Harris
On 7/18/07, Benjamin Arai [EMAIL PROTECTED] wrote: But I want to parrallelize searches if possible to reduce the perofrmance loss of having multiple tables. PostgreSQL does not support parallel query. Parallel query on top of PostgreSQL is provided by ExtenDB and PGPool-II. -- Jonah H.

[GENERAL] Parrallel query execution for UNION ALL Queries

2007-07-18 Thread Benjamin Arai
Hi, If I have a query such as: SELECT * FROM (SELECT * FROM A) UNION ALL (SELECT * FROM B) WHERE blah='food'; Assuming the table A and B both have the same attributes and the data between the table is not partitioned in any special way, does Postgresql execute WHERE blah=food on both table

Re: [GENERAL] [PERFORM] Parrallel query execution for UNION ALL Queries

2007-07-18 Thread Scott Marlowe
On 7/18/07, Benjamin Arai [EMAIL PROTECTED] wrote: Hi, If I have a query such as: SELECT * FROM (SELECT * FROM A) UNION ALL (SELECT * FROM B) WHERE blah='food'; Assuming the table A and B both have the same attributes and the data between the table is not partitioned in any special way, does

Re: [GENERAL] multirow insert

2007-07-18 Thread Dimitri Fontaine
Le samedi 14 juillet 2007, Tom Allison a écrit : On Jul 13, 2007, at 2:11 PM, A. Kretschmer wrote: am Fri, dem 13.07.2007, um 18:50:26 +0200 mailte Zlatko Mati? folgendes: When using multirow INSERT INTO...VALUES command, are all rows inserted in a batch, or row by row? Within

Re: [GENERAL] createing indexes on large tables and int8

2007-07-18 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/17/07 17:12, [EMAIL PROTECTED] wrote: On Tuesday 17 July 2007 17:47:01 Tom Lane wrote: [EMAIL PROTECTED] writes: i think i got it fixed as i saw that i pushed my maintenance_work_mem too high. It was higher than physical ram :-( Ooops, that

Re: [GENERAL] Update of table lags execution of statement by 1 minute?

2007-07-18 Thread Erik Peterson
This happens in the same session. I have an application that had been encountering this issue periodically, and I have rigged it to send me an email whenever it happens. I¹ll get that email, fire up my client, and try to update the row manually. Right after my update (autocommit is on, but it

[GENERAL] monthly tally of new memberships

2007-07-18 Thread brian
I'm trying to create a select statement that will show me the number of new memberships or an organisation by date (first of each month). The member table has a date column to reflect when the member was inserted. So far, i've gotten as far as: SELECT applied AS date_applied, count(id) AS

Re: [GENERAL] Sylph-Searcher 1.0.0 released

2007-07-18 Thread Andrej Ricnik-Bay
On 7/18/07, Tatsuo Ishii [EMAIL PROTECTED] wrote: Hi, Hi, We are pleased to announce that Sylph-Searcher 1.0.0 is released. Sylph-Searcher is a client program for searching mail boxes. Supported mail box format is MH style, i.e. 1 mail = 1 file. Sylph-Searcher uses tsearch2 for full text

Re: [GENERAL] it works, but is it legal to separate schema/table/field references using spaces

2007-07-18 Thread Peter Eisentraut
Frank van Vugt wrote: db=# select avg(pg_catalog    .   pg_stats     . avg_width) from pg_stats; It seems that all whitespace between schema/table/field references is ignored? Sure, this is perfectly valid per SQL and what not. -- Peter Eisentraut http://developer.postgresql.org/~petere/

Re: [GENERAL] monthly tally of new memberships

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 13:29 , brian wrote: This returns the new memberships for each day, ignoring days without any. What i'd like to do though, is to select only the 1st of each month, summing the new memberships or that month, eg: month | applications 2006-05-01 |

Re: [GENERAL] [PERFORM] Parrallel query execution for UNION ALL Queries

2007-07-18 Thread Jim C. Nasby
On Wed, Jul 18, 2007 at 11:30:48AM -0500, Scott Marlowe wrote: EnterpriseDB, a commercially enhanced version of PostgreSQL can do query parallelization, but it comes at a cost, and that cost is making sure you have enough spindles / I/O bandwidth that you won't be actually slowing your system

[GENERAL] DBI/DBD::Pg and transactions

2007-07-18 Thread Roderick A. Anderson
Hopefully the original post went astray and this isn't a duplicate. I don't see it in the archive so I'll assume I have a bogus SMTP setup at work for my home account. I've tried the Pg docs, DBI book, and Google searches but haven't found anything useful on this topic. I realize this is

Re: [GENERAL] monthly tally of new memberships

2007-07-18 Thread Jon Sime
brian wrote: I'm trying to create a select statement that will show me the number of new memberships or an organisation by date (first of each month). The member table has a date column to reflect when the member was inserted. So far, i've gotten as far as: SELECT applied AS date_applied,

Re: [GENERAL] monthly tally of new memberships

2007-07-18 Thread brian
Michael Glaesemann wrote: On Jul 18, 2007, at 13:29 , brian wrote: This returns the new memberships for each day, ignoring days without any. What i'd like to do though, is to select only the 1st of each month, summing the new memberships or that month, eg: month | applications

Re: [GENERAL] monthly tally of new memberships

2007-07-18 Thread Alvaro Herrera
brian wrote: Michael Glaesemann wrote: On Jul 18, 2007, at 13:29 , brian wrote: This returns the new memberships for each day, ignoring days without any. What i'd like to do though, is to select only the 1st of each month, summing the new memberships or that month, eg: month |

Re: [GENERAL] DBI/DBD::Pg and transactions

2007-07-18 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Will a $sth-execute() of a SELECT ... FOR UPDATE statement allow me to update the selected records using $uth-execute( ... ) if $sth and $uth are both created/prepared from the same database handle $dbh? You are allowed to update either

Re: [GENERAL] monthly tally of new memberships

2007-07-18 Thread brian
Alvaro Herrera wrote: brian wrote: Michael Glaesemann wrote: On Jul 18, 2007, at 13:29 , brian wrote: This returns the new memberships for each day, ignoring days without any. What i'd like to do though, is to select only the 1st of each month, summing the new memberships or that month,

[GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
I've got a query that's taking forever (as will be obvious when you see it and the explain output). I can't figure out what indexes to add to make this run faster. I'd appreciate any help. Pat SELECT SUM(CASE WHEN (hit IS TRUE AND logged_in IS TRUE) THEN 1 ELSE 0 END) AS count_hits_console,

Re: [GENERAL] Sylph-Searcher 1.0.0 released

2007-07-18 Thread Tatsuo Ishii
On 7/18/07, Tatsuo Ishii [EMAIL PROTECTED] wrote: Hi, Hi, We are pleased to announce that Sylph-Searcher 1.0.0 is released. Sylph-Searcher is a client program for searching mail boxes. Supported mail box format is MH style, i.e. 1 mail = 1 file. Sylph-Searcher uses tsearch2 for

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
On 7/18/07, Pat Maddox [EMAIL PROTECTED] wrote: I've got a query that's taking forever (as will be obvious when you see it and the explain output). I can't figure out what indexes to add to make this run faster. I'd appreciate any help. Pat SELECT SUM(CASE WHEN (hit IS TRUE AND logged_in

[GENERAL] Feature request: Per database search_path

2007-07-18 Thread Francisco Reyes
As far as I know, currently one can set the search path globally, or on a per role bases. I was wondering if it could be possible to have a per database search_path. I believe this would be not only convenient, but will add flexibility. What got me thinking of this was that I manually ste a

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Michael Glaesemann
On 7/18/07, Pat Maddox [EMAIL PROTECTED] wrote: I've got a query that's taking forever (as will be obvious when you see it and the explain output). I can't figure out what indexes to add to make this run faster. I'd appreciate any help. I'm curious why it's choosing to use hash joins

Re: [GENERAL] Sylph-Searcher 1.0.0 released

2007-07-18 Thread Andrej Ricnik-Bay
On 7/19/07, Tatsuo Ishii [EMAIL PROTECTED] wrote: Yes, sylpheed does not need PostgreSQL. sylph-searcher is an independent application and actually is consisted of two programs: syldbimport and sylph-searcher. syldbimport reads given mail files and stores them into PostgreSQL database, indexing

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
On 7/18/07, Michael Glaesemann [EMAIL PROTECTED] wrote: On 7/18/07, Pat Maddox [EMAIL PROTECTED] wrote: I've got a query that's taking forever (as will be obvious when you see it and the explain output). I can't figure out what indexes to add to make this run faster. I'd appreciate any

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 16:01 , Michael Glaesemann wrote: CREATE OR REPLACE FUNCTION one_when(BOOLEAN) RETURNS INTEGER LANGUAGE SQL as $_$SELECT value_when($1,1)$_$; I forgot to add that you can cast booleans to integers, so one_when (expr) is equivalent to expr::int: # SELECT (true and

[GENERAL] Will partial index creation use existing index?

2007-07-18 Thread Steve Crawford
Does PostgreSQL use an existing index, if possible, when creating a partial index? By way of background, we have some nightly bulk processing that includes a couple of 15-30 million row tables. Most of the processing is only looking at prior-day data (up to ~200,000 rows) and for efficiency

Re: [GENERAL] Update of table lags execution of statement by 1 minute?

2007-07-18 Thread Gregory Stark
Erik Peterson [EMAIL PROTECTED] writes: This happens in the same session. I have an application that had been encountering this issue periodically, and I have rigged it to send me an email whenever it happens. I¹ll get that email, fire up my client, and try to update the row manually.

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 16:12 , Pat Maddox wrote: ERROR: invalid reference to FROM-clause entry for table video_views LINE 20: JOIN assets ON (video_views.video_id=videos.id) ^ HINT: There is an entry for table video_views, but it cannot be referenced from this part of

Re: [GENERAL] DBI/DBD::Pg and transactions

2007-07-18 Thread Roderick A. Anderson
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Will a $sth-execute() of a SELECT ... FOR UPDATE statement allow me to update the selected records using $uth-execute( ... ) if $sth and $uth are both created/prepared from the same database handle $dbh? You are

Re: [GENERAL] DBI/DBD::Pg and transactions

2007-07-18 Thread Alan Hodgson
On Wednesday 18 July 2007 14:29, Roderick A. Anderson [EMAIL PROTECTED] wrote: In the mean time if the script gets triggered again and the first instance isn't finished the second needs to not be able to select those records already being handled. select for update won't do that. It will sit

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
On 7/18/07, Michael Glaesemann [EMAIL PROTECTED] wrote: On Jul 18, 2007, at 16:12 , Pat Maddox wrote: ERROR: invalid reference to FROM-clause entry for table video_views LINE 20: JOIN assets ON (video_views.video_id=videos.id) ^ HINT: There is an entry for table

Re: [GENERAL] DBI/DBD::Pg and transactions

2007-07-18 Thread Roderick A. Anderson
Alan Hodgson wrote: On Wednesday 18 July 2007 14:29, Roderick A. Anderson [EMAIL PROTECTED] wrote: In the mean time if the script gets triggered again and the first instance isn't finished the second needs to not be able to select those records already being handled. select for update won't

Re: [GENERAL] Feature request: Per database search_path

2007-07-18 Thread Richard Huxton
Francisco Reyes wrote: As far as I know, currently one can set the search path globally, or on a per role bases. I was wondering if it could be possible to have a per database search_path. I believe this would be not only convenient, but will add flexibility. ALTER DATABASE leia SET

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
On 7/18/07, Pat Maddox [EMAIL PROTECTED] wrote: On 7/18/07, Michael Glaesemann [EMAIL PROTECTED] wrote: On Jul 18, 2007, at 16:12 , Pat Maddox wrote: ERROR: invalid reference to FROM-clause entry for table video_views LINE 20: JOIN assets ON (video_views.video_id=videos.id)

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 16:48 , Pat Maddox wrote: For some reason the functions you wrote are giving me trouble (there's a BIGINT involved, I tried changing the functions around but kept having issues). You might try these, if you're interested. CREATE OR REPLACE FUNCTION ternary(BOOLEAN,

Re: [GENERAL] Feature request: Per database search_path

2007-07-18 Thread Tom Lane
Francisco Reyes [EMAIL PROTECTED] writes: As far as I know, currently one can set the search path globally, or on a per role bases. I was wondering if it could be possible to have a per database search_path. ALTER DATABASE SET search_path = ... regards, tom lane

Re: [GENERAL] Update of table lags execution of statement by 1 minute?

2007-07-18 Thread Tom Lane
Erik Peterson [EMAIL PROTECTED] writes: I=B9m not sure the corrupted index issue is it. After updating, the attribut= e shows up as the =B3old=B2 value with selects on different columns, ie: UPDATE mytable SET myattribute=3D1 WHERE id=3D14; COMMIT; SELECT * from mytable WHERE

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Pat Maddox
On 7/18/07, Michael Glaesemann [EMAIL PROTECTED] wrote: On Jul 18, 2007, at 16:48 , Pat Maddox wrote: For some reason the functions you wrote are giving me trouble (there's a BIGINT involved, I tried changing the functions around but kept having issues). You might try these, if you're

[GENERAL] IN clause performance

2007-07-18 Thread Pg Coder
Basic query optimization question- does Postgres process x IN (y1, y2) as fast as (x = y1 OR x = y2) in a function?

Re: [GENERAL] Sylph-Searcher 1.0.0 released

2007-07-18 Thread Tatsuo Ishii
On 7/19/07, Tatsuo Ishii [EMAIL PROTECTED] wrote: Yes, sylpheed does not need PostgreSQL. sylph-searcher is an independent application and actually is consisted of two programs: syldbimport and sylph-searcher. syldbimport reads given mail files and stores them into PostgreSQL database,

Re: [GENERAL] Feature request: Per database search_path

2007-07-18 Thread Francisco Reyes
Richard Huxton writes: ALTER DATABASE leia SET search_path = public,lookups; Seems to work for me on 8.2 - you'll need to disconnect and reconnect to see it take place though. Hmm.. I must have typed something wrong when I tried.. For the archives.. If a user has a search path, that takes

Re: [GENERAL] Need help optimizing this query

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 17:34 , Pat Maddox wrote: - Sort (cost=803054.95..809363.98 rows=2523610 width=64) (actual time=67076.407..75441.274 rows=5799447 loops=1) Sort Key: videos.id, videos.title, videos.guid If I'm reading this right, it looks like a

[GENERAL] Can someone shed some light on following error: pg_tblspc/16763/16764/PG_VERSION is missing

2007-07-18 Thread Brijesh Shrivastav
Hi! Some users in our group have reported running into following error occasionally. They couldn't pinpoint a specific set of action that led to this error but don't believe they did anything catastrophic as this error suggest. Any ideas or explanation will be appreciated. FATAL:

Re: [GENERAL] Can't SELECT from (INSERT ... RETURNING)

2007-07-18 Thread Merlin Moncure
On 7/18/07, Nico Sabbi [EMAIL PROTECTED] wrote: I thought I could use the output of INSERT...RETURNING as a set of tuples for a subquery, but it seems it's not the case: nb1=# select * from (insert into m(a) values(112) returning a); ERROR: syntax error at or near into LINE 1: select * from

[GENERAL] tsearch2 on postgres8.2.4

2007-07-18 Thread marcelo Cortez
Hi all has anybody created using Gendict generate dictionary in spanish successful ?. __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya!

[GENERAL] Ordering by a complex field

2007-07-18 Thread Robert James
I have a one varchar field. I'd like to order so that records where field='2' come first, then '1', then '9', then anything but '0', then '0'. Is there anyway to do this in a standard order by clause (that is, without writing a new SQL function)?

Re: [GENERAL] Ordering by a complex field

2007-07-18 Thread Michael Glaesemann
On Jul 18, 2007, at 20:12 , Robert James wrote: I'd like to order so that records where field='2' come first, then '1', then '9', then anything but '0', then '0'. Is there anyway to do this in a standard order by clause (that is, without writing a new SQL function)? # create table

[GENERAL] Database design : international postal address

2007-07-18 Thread Bruno Lavoie
Hello guys, I am currently designing a database which has several tables (e.g. a Customer table) which include address information such as street address, city, state, country code, and zip code, and phone number information in each record. We need to make the schema for these tables

[GENERAL] Query performance strangeness..

2007-07-18 Thread Steve Spicklemire
Hi Folks, I'm new to this list, but I've been using postgresql for a few years. In general I've been able to figure things out by reading various docs. I've hit something now that I haven't been able to sort out at all. It may be that there's some document that explains all this... if

Re: [GENERAL] Query performance strangeness..

2007-07-18 Thread Richard Huxton
Steve Spicklemire wrote: I also have a function get_cem_for_directBurial(personid) that is expensive to call, but it's also indexed, so I hoped that the index would normally be used (essentially as a cache). It returns a 'cemetery code' so I can search for folks buried in a particular

Re: [GENERAL] Feature request: Per database search_path

2007-07-18 Thread Richard Huxton
Francisco Reyes wrote: Is there a way to unset a role's search_path? I had set one role with a particular search path. Now want to take that off so the user can get the database's search_path setting. ALTER ROLE ... RESET search_path; -- Richard Huxton Archonet Ltd

[GENERAL] Unexpected crash

2007-07-18 Thread Mikko Partio
Hello all, I installed the latest version from rpms and everythings ok, except when I connect to a db with psql and press shift+return the backend crashes with Segmentation fault! I guess the problem is with my installation but I don't know how to debug. It's not a very disconcerning thing per

Re: [GENERAL] Unexpected crash

2007-07-18 Thread Tom Lane
Mikko Partio [EMAIL PROTECTED] writes: I installed the latest version from rpms and everythings ok, except when I connect to a db with psql and press shift+return the backend crashes with Segmentation fault! This is not a backend crash, you are SIGQUIT-ing your psql session. Check your

Re: [GENERAL] Unexpected crash

2007-07-18 Thread Richard Huxton
Mikko Partio wrote: Hello all, I installed the latest version from rpms and everythings ok, except when I connect to a db with psql and press shift+return the backend crashes with Segmentation fault! I guess the problem is with my installation but I don't know how to debug. It's not a very