Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > I think the planner would really be abdicating its responsibilities to > generate a plan with that kind of downside risk. Sure, but what about the risk of using a sequential scan the other 99% of the time? The downside risk of the index scan is a 5x slowdow

Re: [GENERAL] stringToNode() for plan nodes...

2004-09-10 Thread Tom Lane
"Katsaros Kwn/nos" <[EMAIL PROTECTED]> writes: > I've read somewhere that there is no support in stringToNode() for Plan > nodes.Is this true? Why would you doubt the statement in readfuncs.c? * NOTES *Path and Plan nodes do not have any readfuncs support, because we *never hav

Re: [GENERAL] PL/pgSQL Function Problem

2004-09-10 Thread Tom Lane
the inquirer <[EMAIL PROTECTED]> writes: > I am trying to create a function that creates a user > and adds a row to a table. It produces no warnings or > errors when I create the function but when I attempt > to execute it I get a syntax error. I do not > understand why this is happening. > CREA

Re: [GENERAL] One Database per Data File?

2004-09-10 Thread Martijn van Oosterhout
Not even close. PostgreSQL uses one or more files per table/index/sequence/etc. Each database has its own directory. I think with tablespaces you can even spread a database over multiple directories. Secondly, every connection gets its very own postmaster, they can can each access any file they wi

[GENERAL] Clustering postgresql

2004-09-10 Thread Björn Voigt
Hello list, has postgresql the functionality for clustering, load balancing and failover. I have to setup two redundant web-servers with and want run a dbms cluster on this machines. My webapps should only see one dbms, but there should be two redundant dbms. I know that mysql 4.1 supports this fea

Re: [GENERAL] One Database per Data File?

2004-09-10 Thread Randy Yates
Christopher Browne <[EMAIL PROTECTED]> writes: > Oops! Randy Yates <[EMAIL PROTECTED]> was seen spray-painting on a wall: >> I'm a complete newbie to postgres so please look the other way if >> these questions are really stupid. >> >> Is it legitimate to have one database per data file? For >> org

[GENERAL] Release of 8.0.0

2004-09-10 Thread Dennis Gearon
WOW, that is the most comprehensive, 'nearing to commercial capability' update of Postgres (and any OTHER OSS project) that I've seen in all my readings about and dealings with Postgres. I would be VERY surprised if Postgres doesn't win some major awards (and accounts) now that this has happened

Re: [GENERAL] error: insert has more expressions than target column

2004-09-10 Thread Björn Lundin
Dino Vliet wrote: > MUCH better nowI did manage to get an insert into > the table lessons with these adjustments...BUT now it > seems the FOR LOOP didn't work because I only get 1 > record and expected that I would get 8 records due to > the i variabele. > > What could be wrong? > > My code

[GENERAL] stringToNode() for plan nodes...

2004-09-10 Thread Katsaros Kwn/nos
Hi! I have a problem with stringToNode() function. I'm trying to convert a Plan into its ASCII representation. This seems to succeed. The problem is that when I try to convert it back with stringToNode() the following error is reported: " ERROR: badly formatted node string "SEQSCAN :startup_cost

Re: [GENERAL] postgres "on in the internet"

2004-09-10 Thread Chris Travers
Hi all; Comments inline. Lincoln Yeoh wrote: I doubt it's a good idea to make your postgres server internet accessible. You'll be using postgresql in what I'd consider to be a less tested scenario. Most people don't expose their database servers to the Internet. You could use the following conf

[GENERAL] Access MDB Schema Import Tool?

2004-09-10 Thread Randy Yates
Is there a tool that allows the tables and relationships of an Access database to be moved into postgresql (7.4.5)? Sorry if this has been asked before. There also may be new tools that have recently come out. -- % Randy Yates % "Watching all the days go by... %% Fuquay-Vari

[GENERAL] V8.0 beta 1 Void type

2004-09-10 Thread Nick Hajek
I am declaring a variaable of type void in a plpgsql function which serves to receive the value(?) returned by another function which has been declared to return a void type. This worked in 7.4 but in testing 8, we receive an error - 'ERROR: variable "dbg" has pseudo-type void'. Is there a change

Re: [GENERAL] HOWTO: Get a table or database definition

2004-09-10 Thread Google Mike
One other option, which I had forgotten for a long time, was: \d ...which can describe many things, although this doesn't give you the CREATE syntax like a pg_dump can do. Please also note that a pg_dump can dump output to the screen if you don't specify a file, so if you're only outputting the

Re: [GENERAL] How do I list the schema for a table or procedure?

2004-09-10 Thread W. Scott Gibson
Google Mike wrote: How do I list the schema for a table or procedure? Is there a command I can do in psql to list this, or do I have to join a series of tables to see that? You can do a "pg_dump -s " to see the full schema of the database. To see just a table of the database issue the command "p

[GENERAL] Migrating from MaxDB to postgresql

2004-09-10 Thread John
As per subject, i'm considering migrating a database (still in development) from MaxDB to postgresql. The main reason for this is that the stored procedures (functions) in MaxDB are unreliable and hard to debug, and that the JDBC driver is still experimental. I thought I'd post here to find out

[GENERAL] postgresql hanging (blocking) with smp kernel

2004-09-10 Thread Marcel Groner
I have a problem with postgresql runnung on smp kernel. setup: master: --- - Pentium 4 (hyperthreading) - 2 GB Memory - os: fedora core 1 - kernel: 2.4.22-1.2188.nptlsmp - postgresql: 7.4.3-1PGDG slave 1: - Pentium 4 (hyperthreading) - 2 GB Memory - os: fedora core 1 - kernel: 2.4.2

Re: [GENERAL] Salt in encrypted password in pg_shadow

2004-09-10 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > This means it's quite possible the NSA had differential cryptanalysis > 30 years before anyone else. s/quite possible/known fact/ > Quite a remarkable achievement. However > it's unlikely that the same situation holds today. Why would you think that? The

[GENERAL] PL/pgSQL Function Problem

2004-09-10 Thread the inquirer
I am trying to create a function that creates a user and adds a row to a table. It produces no warnings or errors when I create the function but when I attempt to execute it I get a syntax error. I do not understand why this is happening. Any help would be greatly appreciated. SELECT create_aut

[GENERAL] help turning of NOTICE messages

2004-09-10 Thread Alex Soto
Hi All, I'm developing some scripts to create my schema to be run by other folks and I'd like to have them not spit out those NOTICE messages when you create a table regarding the implicit indexes that are made since it just makes it harder to see when there is a real error. I've tried running ps

Re: [GENERAL] Salt in encrypted password in pg_shadow

2004-09-10 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > > it's unlikely that the same situation holds today. > > Why would you think that? The US government may not have too many > clues, but they certainly understand the importance of crypto. I cannot > think of any reason to suppose that NSA et al would have

[GENERAL] Auto increment/sequence on multiple columns?

2004-09-10 Thread Nick
Is it possible to have a sequence across two columns. For example table1 +---+---+ | a | b | +---+---+ | 1 | 1 | | 1 | 2 | | 1 | 3 | | 2 | 1 | | 2 | 2 | | 2 | 3 | | 3 | 1 | | 3 | 2 | | 3 | 3 | +---+---+ Would I have to create a new sequence for every unique 'a' column? That seems pretty tedious.

[GENERAL] HOWTO: Get a table or database definition

2004-09-10 Thread Google Mike
I guess it would be great if Pgsql had a way to find a database definition via a system stored procedure like other database platforms have. There are two ways I've found so far: SELECT attname as "name", typname as "type", atttypmod - 4 as "size", relhaspkey as "is_primary_key", * FROM p

Re: [GENERAL] Migrating from MaxDB to postgresql

2004-09-10 Thread John
Christopher Browne wrote: Quoth John <[EMAIL PROTECTED]>: As per subject, i'm considering migrating a database (still in development) from MaxDB to postgresql. The main reason for this is that the stored procedures (functions) in MaxDB are unreliable and hard to debug, and that the JDBC driver is s

[GENERAL] One Database per Data File?

2004-09-10 Thread Randy Yates
I'm a complete newbie to postgres so please look the other way if these questions are really stupid. Is it legitimate to have one database per data file? For organizational and backup purposes, I'd like to keep the database files for each of several projects separate. This means, e.g., that postma

[GENERAL] Best practices for migrating a development database to a release database

2004-09-10 Thread Collin Peters
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the simplest example of my situation (real world would be more complex). Say you have two versions of your

Re: [GENERAL] Salt in encrypted password in pg_shadow

2004-09-10 Thread Gaetano Mendola
Greg Stark wrote: Gaetano Mendola <[EMAIL PROTECTED]> writes: Well, when SHA-0 was ready NSA suggested to apply some changes in order to correct some flaw discovered and SHA-1 comes out, interesting NSA never wrote which flaw was corrected! May be SHA-1 is trasparent water to NSA eyes :-) This is

[GENERAL] What is the postgres version of mysql's "ON DUPLICATE KEY"

2004-09-10 Thread Nick
I have a table with columns (product_id,related_product_id,related_counter) If product A is related to product B then a record should be created, if the record already exists then the related_counter should be incremented. This is very easy to do with MySQL using INSERT... ON DUPLICATE KEY. Stand

[GENERAL] unicode and varchar

2004-09-10 Thread Michael Wimmer
Hi all, I have a problem when inserting into a varchar field via jdbc. Using to bytes makes the varchar fields shorten. Example: with 7.4.5. on Linux create table test(charfield varchar(5)); insert into test(charfield) values('abcde'); insert into test(charfield) values('üö'); select bit_length(cha

[GENERAL] Firewall Security Requirements for Postgresql Access

2004-09-10 Thread Randy Yates
Is opening up port 5432 (R/W both directions) all that is required of a firewall in order to access a postgres database outside the firewall? -- % Randy Yates % "My Shangri-la has gone away, fading like %% Fuquay-Varina, NC% the Beatles on 'Hey Jude'" %%% 919-577-9

[GENERAL] Datatypes Documentation

2004-09-10 Thread Randy Yates
It might be a good idea to place a reference to table 8-1 in the various subsections of the Datatypes section in the online postgresql documentation. Otherwise, when hyperjumping from the table of contents to a specific section, table 8-1 may not be in sight (as it is not for integer datatypes) and

[GENERAL] initdb crashes under Windows

2004-09-10 Thread Randy Yates
Can't get the postgres server started under Win2000/cygwin. Here's what happens: $ initdb -D /Gauss/rr/data -W The files belonging to this database system will be owned by user "yates". This user must also own the server process. The database cluster will be initialized with locale C. fixing pe

[GENERAL] cygserver -S crashes under Windows 2000/cygwin

2004-09-10 Thread Randy Yates
$ /usr/sbin/cygserver -S Segmentation fault (core dumped) [EMAIL PROTECTED] ~ $ -- % Randy Yates % "...the answer lies within your soul %% Fuquay-Varina, NC% 'cause no one knows which side %%% 919-577-9882% the coin will fall."

[GENERAL] building postgres for windows 2000?

2004-09-10 Thread Randy Yates
Has anyone successfully done this? I've got cygwin and the very first step crashes - bash-2.05$ pwd pwd /cygdrive/e bash-2.05$ cd postgresql-7.4.5 cd postgresql-7.4.5 bash-2.05$ ./configure ./configure bash: ./configure: bad interpreter: No such file or directory bash-2.05$ -- % Randy Yates

[GENERAL] Another Security Question: User-based Roles vs. Application Business Rules

2004-09-10 Thread Randy Yates
Forgive me if this is a basic and trivial (i.e., stupid) question. I haven't been using postgres very long, and I'm not an experienced database system developer. I noticed that there is a very powerful group-based security feature in postgres. Very nice - I like it alot. So one way to implement se

Re: [GENERAL] Obtaining the Julian Day from a date

2004-09-10 Thread Bruno Wolff III
On Thu, Sep 09, 2004 at 16:32:18 -0500, "Karl O. Pinc" <[EMAIL PROTECTED]> wrote: > > Unfortunately modulo (%) does not operate on dates so I still need > > to convert to Julian day. :-( I need to know where I am within a > regular repeating interval. Mostly, in my case, modulo 2. > (We arbi

Re: [GENERAL] 8.0.0beta2: gcc: unrecognized option `-pthreads'

2004-09-10 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > No. The problem is that the test script just tries all options and if > > it doesn't error out, it uses it. Ideally we could test from configure > > and ingnore meaningless options but we don't know how yet. > > Drop any options tha

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Dan Sugalski
At 6:33 PM -0400 9/10/04, Tom Lane wrote: Dan Sugalski <[EMAIL PROTECTED]> writes: Since the only difference in this case is that the parameters are pulled out for transport rather than being in band (a properly-escaped string substitution could turn this case from a PQexecParams call into a PQ

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Tom Lane
Dan Sugalski <[EMAIL PROTECTED]> writes: > Since the only difference in this case is that the parameters are > pulled out for transport rather than being in band (a > properly-escaped string substitution could turn this case from a > PQexecParams call into a PQexec call) I was thinking the thing

Re: [GENERAL] What is the postgres version of mysql's "ON DUPLICATE KEY"

2004-09-10 Thread Kevin Barnard
UPDATE related_products SET related_counter = related_counter WHERE . only updates if the record exists INSERT (x,y,z) SELECT ?,?,1 WHERE NOT EXISTS (SELECT 1 FROM related_products WHERE .) Inserts if the key does not exist. On Sat, 11 Sep 2004 00:02:26 +0200, Gaetano Mendola <[EMAIL PR

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Dan Sugalski
At 5:55 PM -0400 9/10/04, Tom Lane wrote: Dan Sugalski <[EMAIL PROTECTED]> writes: Would I regret it if I asked where in the source this lies so I could go fix it? If it were easy to fix it would have been fixed before now ... Oh, I wasn't expecting it to be an *easy* fix... :) The question is w

Re: [GENERAL] 8.0.0beta2: gcc: unrecognized option `-pthreads'

2004-09-10 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > No. The problem is that the test script just tries all options and if > it doesn't error out, it uses it. Ideally we could test from configure > and ingnore meaningless options but we don't know how yet. Drop any options that cause the compiler to writ

Re: [GENERAL] pg_dump/pg_dumpall do not correctly dump search_path

2004-09-10 Thread Bruce Momjian
Would someone answer this report?. Looks strange to me. --- Ben Trewern wrote: > All, > > There seems to be a bug in pg_dumpall: > > For one of my dbs I've done: > > ALTER DATABASE dbname SET search_path = mw, public; >

Re: [GENERAL] 8.0.0beta2: Ownership of implicit sequences after dump/restore

2004-09-10 Thread Bruce Momjian
Georgi Chorbadzhiyski wrote: > I just experienced the same problem [1] with 8.0.0beta2. > > [1] http://archives.postgresql.org/pgsql-bugs/2004-08/msg00086.php Right. It is still on the open items list. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED]

Re: [GENERAL] What is the postgres version of mysql's "ON DUPLICATE KEY"

2004-09-10 Thread Gaetano Mendola
Nick wrote: I have a table with columns (product_id,related_product_id,related_counter) If product A is related to product B then a record should be created, if the record already exists then the related_counter should be incremented. This is very easy to do with MySQL using INSERT... ON DUPLICATE

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Tom Lane
Dan Sugalski <[EMAIL PROTECTED]> writes: > Would I regret it if I asked where in the source this lies so I could > go fix it? If it were easy to fix it would have been fixed before now ... I have toyed with the notion of converting "var LIKE pattern" to "var LIKE pattern AND var >= lowbound(patt

Re: [GENERAL] 8.0.0beta2: gcc: unrecognized option `-pthreads'

2004-09-10 Thread Bruce Momjian
Ed L. wrote: > Is this pthreads warning of any concern? > > gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes > -Wmissing-declarations -pthread -pthreads -D_REENTRANT -D_THREAD_SAFE > -D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libecpg.so.4 execute.o > typename.o descriptor.o da

[GENERAL] how to constrain a query to return 1 or 0 rows (or >1 or 0 rows)

2004-09-10 Thread Kevin Murphy
This is probably a stupid question, but ... I'd like to be able to take an existing query and modify it to return a single row if that's what the base query returns, and 0 rows if the base query returns multiple rows. Similarly, I'd like to also modify it to return multiple rows if that's what

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Dan Sugalski
At 5:19 PM -0400 9/10/04, Tom Lane wrote: Dan Sugalski <[EMAIL PROTECTED]> writes: I'd figure, though, that since the parameters are being passed into PQexecParams basically to get them out of band so I don't have to deal with escaping, quoting, and suchlike things, that the optimizer would loo

Re: [GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Tom Lane
Dan Sugalski <[EMAIL PROTECTED]> writes: > I'd figure, though, that since the parameters are being passed > into PQexecParams basically to get them out of band so I don't have > to deal with escaping, quoting, and suchlike things, that the > optimizer would look at things *after* the substitutio

Re: [GENERAL] SMgrRelation hashtable corrupted

2004-09-10 Thread Tom Lane
"Chris Ochs" <[EMAIL PROTECTED]> writes: > On 8 beta1 I get 'SMgrRelation hashtable corrupted' *sometimes* when > executing the following, but only when there are other clients connecting to > the same database. Hmm. The SMgrRelation hashtable is local in each backend, so I'm not sure I believe

[GENERAL] Speeding up LIKE with placeholders?

2004-09-10 Thread Dan Sugalski
Is there any good way to speed up SQL that uses like and has placeholders? Here's the scoop. I've got a system that uses a lot of pre-generated SQL with placeholders in it. At runtime these SQL statements are fired off (through the C PQexecParams function, if that matters) for execution. No prep

[GENERAL] unsubscribe

2004-09-10 Thread Bodanapu, Sravan
Title: unsubscribe unsubscribe This message, including any attachments, contains confidential information intended for a specific individual and purpose and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies.

[GENERAL] SMgrRelation hashtable corrupted

2004-09-10 Thread Chris Ochs
On 8 beta1 I get 'SMgrRelation hashtable corrupted' *sometimes* when executing the following, but only when there are other clients connecting to the same database. ALTER TABLE declines ALTER COLUMN comp_name TYPE varchar(128), ALTER COLUMN f_name1 TYPE varchar(48), ALTER COLUMN l_nam

Re: [GENERAL] Display of text fields

2004-09-10 Thread Ennio-Sr
* Stephan Szabo <[EMAIL PROTECTED]> [100904, 10:39]: > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > > * Stephan Szabo <[EMAIL PROTECTED]> [100904, 07:10]: > > > > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > > > [ big cut ] > > > > > Well, I'd expect that for large tables the outer join type solutio

Re: [GENERAL] Display of text fields

2004-09-10 Thread Stephan Szabo
On Fri, 10 Sep 2004, Ennio-Sr wrote: > * Stephan Szabo <[EMAIL PROTECTED]> [100904, 09:05]: > > > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > > > * Stephan Szabo <[EMAIL PROTECTED]> [100904, 07:10]: > > > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > > [ big cut ] > > > > Note however, that this m

Re: [GENERAL] Display of text fields

2004-09-10 Thread Ennio-Sr
* Stephan Szabo <[EMAIL PROTECTED]> [100904, 09:05]: > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > * Stephan Szabo <[EMAIL PROTECTED]> [100904, 07:10]: > > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > [ big cut ] > > Note however, that this may very well perform poorly compared to other > solut

Re: [GENERAL] Display of text fields

2004-09-10 Thread Stephan Szabo
On Fri, 10 Sep 2004, Ennio-Sr wrote: > * Stephan Szabo <[EMAIL PROTECTED]> [100904, 07:10]: > > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > > > I slightly modified your queries and the result gets nearer my goals, > > > but ... > > > Here is what I tried: > > > [ ... ] > > > > As an explanation of

Re: [GENERAL] Display of text fields

2004-09-10 Thread Ennio-Sr
* Stephan Szabo <[EMAIL PROTECTED]> [100904, 07:10]: > On Fri, 10 Sep 2004, Ennio-Sr wrote: > > > I slightly modified your queries and the result gets nearer my goals, > > but ... > > Here is what I tried: > > [ ... ] > > As an explanation of the duplicate rows: > > FROM bib_lt t0, bibbt t1 with

Re: [GENERAL] referential integrity preventing simultaneous insert

2004-09-10 Thread Michael Fuhr
On Thu, Sep 09, 2004 at 12:53:57PM -0500, Edwin Grubbs wrote: > I have experienced problems with postgres hanging when two inserts > reference the same foreign key. It appears that the second insert is > waiting for the first insert to release a lock. You can also create a deadlock situation: tr

[GENERAL] Canceling Query due to user request

2004-09-10 Thread Bart McFarling
postgres 7.4.2 on a RedHat Enterprise Server using libpq on SCO Open Server Seems that if a command takes too long I get ERROR:Canceling query due to user request. I have ulimit=unlimited postgresql.conf has statement_timeout = 0 Any ideas on what could be causing this? Thanks, Bart -

Re: [GENERAL] Display of text fields

2004-09-10 Thread Stephan Szabo
On Fri, 10 Sep 2004, Ennio-Sr wrote: > I slightly modified your queries and the result gets nearer my goals, > but ... > Here is what I tried: > > SELECT DISTINCT > /* despite the DISTINCT, it shows twice each matching record: once > with the memo fieldd and then without it!. Leaving out the DIST