[GENERAL] ANNOUNCE: SHSQL - SQL for LINUX/UNIX Shell scripts

2004-11-04 Thread Eddy Macnaghten
Hi I have just released SHSQL under the GPL, it is a method how SQL can be easily integrated into shell scripts. The web site is at http://www.edlsystems.com/shsql and can be downloaded from ftp://ftp.edlsystems.com/shsql (Needless to say a PostgreSQL version is included) Enjoy Eddy -- Edward

Re: [GENERAL] how to edit a function from psql?

2004-11-04 Thread Alvaro Herrera
On Thu, Nov 04, 2004 at 04:00:10PM -0600, Thomas F. O'Connell wrote: Thomas, > How do you get the results of \df+ into the buffer with \e? Just copy > and paste? Right. Single quotes tended to be an issue. Not so with 8.0. It's much better, of course, to have the original definition on a tex

Re: [GENERAL] how to edit a function from psql?

2004-11-04 Thread Thomas F . O'Connell
Alvaro, How do you get the results of \df+ into the buffer with \e? Just copy and paste? -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-0005 On Nov 4, 2004, at 3:40 PM, Alvaro Her

Re: [GENERAL] how to edit a function from psql?

2004-11-04 Thread Patrick Hatcher
Thanks Alvaro. That was what I was looking for. Patrick Hatcher Alvaro Herrera <[EMAIL PROTECTED]> 11/04/04 03:40 PM To "Thomas F.O'Connell" <[EMAIL PROTECTED]> cc Patrick Hatcher <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject Re: [GENERAL] how to edit a function from psql?

Re: [GENERAL] how to edit a function from psql?

2004-11-04 Thread Alvaro Herrera
On Thu, Nov 04, 2004 at 02:22:06PM -0600, Thomas F.O'Connell wrote: > To the best of my knowledge, this is not possible in psql. > > You can edit individual queries with \e, but I don't think it's > possible to edit functions. It is of course possible get the definition using \df+ and then use C

Re: [GENERAL] PostgreSQL on Linux PC vs MacOS X

2004-11-04 Thread Timothy Perrigo
I've been working with PostgreSQL on OS X (G4, G5 and dual G5 systems) for a few months now, and overall I've been really pleased; for us, it seems to be a good match. If you have both an OS X and a Linux or BSD system available, you could run pgbench against both and get a rough idea on how th

Re: [GENERAL] disabling constraints

2004-11-04 Thread Tom Lane
Vivek Khera <[EMAIL PROTECTED]> writes: > "DP" == David Parker <[EMAIL PROTECTED]> writes: > DP> I would like to be able to truncate all of the tables in a schema > DP> without worrying about FK constraints. I tried issuing a "SET > DP> CONSTRAINTS ALL DEFERRED" before truncating, but I still get >

Re: [GENERAL] disabling constraints

2004-11-04 Thread David Parker
Hi. Thanks for responding. I don't *think* there are circular references, but the nature of the problem is that the code doesn't know anything about the semantics of the schema - it just gets the list of tables, and there are multiple schemas it needs to handle, all of which may change over time.

Re: [GENERAL] how to edit a function from psql?

2004-11-04 Thread Thomas F.O'Connell
To the best of my knowledge, this is not possible in psql. You can edit individual queries with \e, but I don't think it's possible to edit functions. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN

Re: [GENERAL] routine reindexing in 7.4.6/8.0?

2004-11-04 Thread Vivek Khera
> "EL" == Ed L <[EMAIL PROTECTED]> writes: EL> What is the conventional wisdom about routine reindexing with EL> 7.4.6 and 8.0? Is it still considered an important maintenance EL> task? If so, how frequently is it needed? I haven't seen a need to reindex since upgrading from 7.2 to 7.4. Und

Re: [GENERAL] disabling constraints

2004-11-04 Thread Vivek Khera
> "DP" == David Parker <[EMAIL PROTECTED]> writes: DP> I would like to be able to truncate all of the tables in a schema DP> without worrying about FK constraints. I tried issuing a "SET DP> CONSTRAINTS ALL DEFERRED" before truncating, but I still get DP> constraint errors. Is there a way to d

Re: [GENERAL] PostgreSQL on Linux PC vs MacOS X

2004-11-04 Thread William Yu
My guess is that you will get better performance from a similarly priced Dual Opteron for the following reasons: 1) OS-X is not 64-bit yet, 64-bit Linux/BSD OS's are available 2) GCC is far better tuned for x86 than PowerPC/Itanium/etc 3) Postgres *seems* to prefer Opteron's ondie memory controll

Re: [GENERAL] create a text file from postgres (like Oracle UTL_FILE package)

2004-11-04 Thread Thomas F.O'Connell
It seems like you would find it much easier to do this with a language external to postgres (E.g., Perl) than relying on any of the built-in languages and file I/O mechanisms. Is there a reason you need postgres to handle this functionality? -tfo -- Thomas F. O'Connell Co-Founder, Information Ar

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Kari Lavikka
> Tthe problem with this is that this is not very random. > If the uids 3 to 3 have been missing, but > the uids are more or less contiguous apart from that, > the uid 4 would be 1 times more likely to be selected > than average. There are some gaps but distribution of them is qui

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Tom Lane
"gnari" <[EMAIL PROTECTED]> writes: > Tthe problem with this is that this is not very random. > If the uids 3 to 3 have been missing, but > the uids are more or less contiguous apart from that, > the uid 4 would be 1 times more likely to be selected > than average. There is some di

[GENERAL] how to edit a function from psql?

2004-11-04 Thread Patrick Hatcher
How can I view and edit a function in psql?  I have been using PgAdmin to do this but wanted to try the command line TIA Patrick Hatcher

Re: [GENERAL] Selecting a random row

2004-11-04 Thread gnari
From: "Kari Lavikka" <[EMAIL PROTECTED]> > > Actually I found an answer. If a I wrap the split point selection to > subquery then the range of results is from 0 to maximum value (~120k in > this case) > > galleria=> SELECT u.uid FROM users u WHERE u.status = 'a' AND uid >= > (select cast(cast((SELE

Re: [GENERAL] VACUUMING questions...

2004-11-04 Thread Richard Huxton
Matthew T. O'Connor wrote: Richard Huxton wrote: Joe Maldonado wrote: Hello all, I have a few somewhat simple questions Does the postmaster vacuum it's internal (pg_*) tables? if not what is the best way to vacuum them without having to vacuum the entire db? and how often is this recomme

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Richard_D_Levine
Kari, Why not select count(*) from the table and multiply it by a true 0.0 - 1.0 pseudo random number generator? Then adjust the outcome for the range of uids. If the uids (or some other column) are contiguous starting at 0, this would be a snap. Rick

Re: [GENERAL] [PERFORM] Restricting Postgres

2004-11-04 Thread Kevin Barnard
I am generally interested in a good solution for this. So far our solution has been to increase the hardware to the point of allowing 800 connections to the DB. I don't have the mod loaded for Apache, but we haven't had too many problems there. The site is split pretty good between dynamic and n

Re: [GENERAL] VACUUMING questions...

2004-11-04 Thread Matthew T. O'Connor
Richard Huxton wrote: Joe Maldonado wrote: Hello all, I have a few somewhat simple questions Does the postmaster vacuum it's internal (pg_*) tables? if not what is the best way to vacuum them without having to vacuum the entire db? and how often is this recommended to be done? No, and I

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Tom Lane
Kari Lavikka <[EMAIL PROTECTED]> writes: > -- > -- Choose a random point between 0 and max_uid and select the first > -- value from the bigger part > -- > CREATE OR REPLACE FUNCTION random_uid() RETURNS int4 AS > 'SELECT uid FROM users u WHERE u.status = ''a'' AND uid >= >cast(cast(max_uid()

[GENERAL] create a text file from postgres (like Oracle UTL_FILE package)

2004-11-04 Thread Leo Martin Orfei
Hi, Anybody know/have functions or package to create text file from postgres function? I want to execute a function to take some fields from a table and save it in a text file (or xml format). I need function like: createfile(filename); appendtofile(filename,text); etc. thanks

Re: [GENERAL] OS X Install

2004-11-04 Thread Jim Crate
I'm a little late to the party, but figured I could at least offer some info for the archives. If you don't know the user's password, and you have admin access, then it really doesn't matter. In fact, I set any special users (pgsql, mailman, etc.) up so that they *cannot* be logged into normally.

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Kari Lavikka
Replying to myself.. Actually I found an answer. If a I wrap the split point selection to subquery then the range of results is from 0 to maximum value (~120k in this case) galleria=> SELECT u.uid FROM users u WHERE u.status = 'a' AND uid >= (select cast(cast((SELECT uid FROM users WHERE status

Re: [GENERAL] VACUUMING questions...

2004-11-04 Thread Richard Huxton
Joe Maldonado wrote: Hello all, I have a few somewhat simple questions Does the postmaster vacuum it's internal (pg_*) tables? if not what is the best way to vacuum them without having to vacuum the entire db? and how often is this recommended to be done? No, and I'd vacuum full template

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Csaba Nagy
IIRC, this was discussed a few times on this list, searching the archives might get you some results. AFAIR, the only way to do it efficiently is to have a column specially assigned for this purpose, and populate it with random numbers in a big range. The column should be indexed to assure fast acc

[GENERAL] VACUUMING questions...

2004-11-04 Thread Joe Maldonado
Hello all, I have a few somewhat simple questions Does the postmaster vacuum it's internal (pg_*) tables? if not what is the best way to vacuum them without having to vacuum the entire db? and how often is this recommended to be done? Thanks, -Joe ---(end of bro

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Kari Lavikka
Works but is too slooow. Shuffling whole table and selecting the first row is not the way to go in this case. Limit (cost=5340.74..5340.74 rows=1 width=4) -> Sort (cost=5340.74..5440.70 rows=39986 width=4) Sort Key: random() -> Seq Scan on users (cost=0.00..2284.37 rows

Re: [GENERAL] Selecting a random row

2004-11-04 Thread Holger Klawitter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 04 November 2004 12:36, Kari Lavikka wrote: > Is there any explanation for this strange behavior or are there better > ways to select a random row? How about SELECT ...whatever... ORDER BY random() LIMIT 1; Mit freundlichem Gruß

[GENERAL] Selecting a random row

2004-11-04 Thread Kari Lavikka
Hi! I have to select a random row from a table where primary key isn't continuous (some rows have been deleted). Postgres just seems to do something strange with my method. -- -- Use the order by desc limit 1 -trick to get maximum value -- CREATE OR REPLACE FUNCTION max_uid() RETURNS int4 AS '

[GENERAL] visiting Seoul, Korea

2004-11-04 Thread Tatsuo Ishii
People, I will visit Seoul, Korea to attend "3rd Northeast Asia OSS Promotion Forum" from Dec 1st to Dec 5th. I would like to meet with someone from Korean PostgreSQL community. Please let me know if you are interested in. -- Tatsuo Ishii ---(end of broadcast)-