[GENERAL] bayesian classification over tsvector

2009-08-20 Thread Ivan Sergio Borgonovo
I was wondering if there is some apps, technique, tool to get inspiration or just use to classify rows according to a weighted tsvector. Each row contain a tsvector obtained concatenating 4 rows with different weight. I've a corpus for each group. I'd like to classify the rows that haven't been

Re: [GENERAL] DB Design Advice

2009-08-20 Thread stone...@excite.com
>stone...@excite.com wrote: >> Hey all, >> >> My company is designing a database in which we intend to store data >> for several customers. We are trying to decide if, >> >> A: we want to store all customer data in one set of tables with >> customer_id fields separating the data or, >> B: storing

Re: [GENERAL] "Could not open relation XXX: No such file or directory"

2009-08-20 Thread Yaroslav Tykhiy
On 21/08/2009, at 12:40 PM, Seth Gordon wrote: Yaroslav Tykhiy wrote: By the way, `chkdsk' in Windows or `fsck' in Unix can, in a way, be a _source_ of file loss if the file metadata got damaged badly, e.g., by a system crash, and the file node has to be cleared. So I've always been curio

Re: [GENERAL] DB Design Advice

2009-08-20 Thread John R Pierce
stone...@excite.com wrote: Hey all, My company is designing a database in which we intend to store data for several customers. We are trying to decide if, A: we want to store all customer data in one set of tables with customer_id fields separating the data or, B: storing each customers

[GENERAL] DB Design Advice

2009-08-20 Thread stone...@excite.com
Hey all,My company is designing a database in which we intend to store data for several customers.  We are trying to decide if,A:  we want to store all customer data in one set of tables with customer_id fields separating the data or,B:  storing each customers data in a separate schema.I'd like

Re: [GENERAL] join from array or cursor

2009-08-20 Thread Scott Bailey
John DeSoi wrote: Suppose I have an integer array (or cursor with one integer column) which represents primary keys of some table. Is there a simple and efficient way to return the rows of the table corresponding to the primary key values and keep them in the same order as the array (or cursor

Re: [GENERAL] "Could not open relation XXX: No such file or directory"

2009-08-20 Thread Seth Gordon
Yaroslav Tykhiy wrote: By the way, `chkdsk' in Windows or `fsck' in Unix can, in a way, be a _source_ of file loss if the file metadata got damaged badly, e.g., by a system crash, and the file node has to be cleared. So I've always been curious if there is a way to retrieve surviving records f

Re: [GENERAL] question about /etc/init.d/postgresql in PGDG

2009-08-20 Thread Tom Lane
Scott Marlowe writes: > In the init script from the PGDG rpms there's this block of code: > PGDATA=/var/lib/pgsql/data > if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ] > then > echo "Using old-style directory structure" > else > PGDATA=/var/lib/pgsql/data > fi >

Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-20 Thread Clemens Schwaighofer
On Thu, Aug 20, 2009 at 21:52, Jasen Betts wrote: > On 2009-08-19, Clemens Schwaighofer wrote: >> On Wed, Aug 19, 2009 at 02:11, Randal L. Schwartz >> wrote: "Andre" == Andre Lopes writes: >>> >>> Andre> I'm developing a function with some checks, for example... to check >>> if the >>>

[GENERAL] join from array or cursor

2009-08-20 Thread John DeSoi
Suppose I have an integer array (or cursor with one integer column) which represents primary keys of some table. Is there a simple and efficient way to return the rows of the table corresponding to the primary key values and keep them in the same order as the array (or cursor)? Seems like i

Re: R: [GENERAL] Field's position in Table

2009-08-20 Thread Scott Marlowe
On Thu, Aug 20, 2009 at 7:45 PM, Yaroslav Tykhiy wrote: > On 20/08/2009, at 7:24 PM, vinny wrote: > >> I can't really think of any real reason to put the field at a particular >> position, applications >> don't reallty care about the order of fields. > > ... unless an application is brain-damaged b

Re: R: [GENERAL] Field's position in Table

2009-08-20 Thread Yaroslav Tykhiy
On 20/08/2009, at 7:24 PM, vinny wrote: I can't really think of any real reason to put the field at a particular position, applications don't reallty care about the order of fields. ... unless an application is brain-damaged by its using a wildcard select, which is a well-known no-no even

Re: [GENERAL] "Could not open relation XXX: No such file or directory"

2009-08-20 Thread Yaroslav Tykhiy
Hi there, On 19/08/2009, at 8:38 PM, Craig Ringer wrote: On 19/08/2009 6:26 PM, Alan Millington wrote: 2009-08-19 03:06:45 ERROR: could not read block 0 of relation 1663/52752/52896: No such file or directory Clearly something is amiss, but I don't know what. I should be grateful for any

Enc: Res: [GENERAL] Function for replace

2009-08-20 Thread paulo matadr
- Mensagem encaminhada De: paulo matadr Para: Sam Mason Enviadas: Quinta-feira, 20 de Agosto de 2009 21:57:29 Assunto: Res: [GENERAL] Function for replace because my application give error when try to reregister  some   features. I have a  many cases that use this  feature

Re: [GENERAL] Regarding installing & starting Postgres on Windows

2009-08-20 Thread John R Pierce
Vikram Patil wrote: Hello , I am trying to find a way to install PostgreSQL through my script/code . I don’t want to use installer provided on websites. I compiled source and and I installed in one directory , Now I am trying to register it as a service or start database server directly.

Re: [GENERAL] Function for replace

2009-08-20 Thread Sam Mason
On Thu, Aug 20, 2009 at 01:50:42PM -0700, paulo matadr wrote: > In my database recently change backslash_quote to safe_enconding, now > a need replace characters blocked to space or nothing. Why do you want to do that? Nothing is "blocked" now, it just changes the default format for literals that

[GENERAL] Function for replace

2009-08-20 Thread paulo matadr
Hi all, In my database recently change backslash_quote to safe_enconding, now a need replace characters blocked to space or nothing. I think create a function to scan every table in database, anybody make a similar work or have this made? thanks

[GENERAL] Regarding installing & starting Postgres on Windows

2009-08-20 Thread Vikram Patil
Hello , I am trying to find a way to install PostgreSQL through my script/code . I don't want to use installer provided on websites. I compiled source and and I installed in one directory , Now I am trying to register it as a service or start database server directly. I read in

[GENERAL] locking/waiting queries

2009-08-20 Thread Kevin Kempter
Hi all ; were seeing a backlog of queries in pg_stat_activity. The system has slowed big time. I see many many queries where waiting = 't' I want to find out for each query which query they are waiting on (who's doing the blocking). What's the best way to find this, I looked at pg_locks for r

[GENERAL] Out of memory on pg_dump

2009-08-20 Thread Chris Hopkins
Hi all - We are using Postgres 8.2.3 as our Confluence backing store and when trying to backup the database at night we are seeing this in the logs: pg_amop_opc_strat_index: 1024 total in 1 blocks; 216 free (0 chunks); 808 used pg_aggregate_fnoid_index: 1024 total in 1 blocks; 392 free (

Re: [GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-20 Thread Alvaro Herrera
Ivan Sergio Borgonovo wrote: > I've > > create table pr( > code varchar(16) primary key, > ... > ); > create sequence pr_code_seq owned by pr.code; -- uh! > > pr.code will *mostly* be obtained as > > to_hex(feistel_encrypt(nextval('pr_code'))) > and sometimes 'manually' inserting unique code

Re: [GENERAL] Clustering with enough work_mem: copy heap in mem?

2009-08-20 Thread Scara Maccai
> There was an > attempt to fix it (for example so that it could try to do a > seqscan+sort > instead of indexscan), but it stalled. Actually I read that, but it's complicated... it involves planning and a lot of other stuff I don't even know about... My "solution" I guess would be easier (but,

Re: [GENERAL] unique index for periods

2009-08-20 Thread Jeff Davis
On Thu, 2009-08-20 at 13:35 +0200, Harald Fuchs wrote: > Have a look at http://pgfoundry.org/projects/temporal The temporal project on pgfoundry only provides the time period type, which is (hopefully) useful, but it does not help with a non-overlapping constraint. Please see my other project her

Re: [GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Craig Ringer
On 20/08/2009 10:20 PM, Tom Lane wrote: Jorge Daine Quiambao writes: I keep getting... "ERROR: could not access file "$libdir/xxid": No such file or directory" whenever I create a new cluster. I've checked the pg directory and the xxid files are in shared folder. The "no such file" complaint

[GENERAL] German ispell dictionary: error parsing affix file

2009-08-20 Thread Christof König
Hi, I'm trying to get a German ispell dictionary to work with postgresql 8.3.7 which supports compound words. I tried the following three dictionaries: - http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/de_DE_frami.zip (for OpenOffice 2), - http://extensions.services.op

Re: [GENERAL] unique index for periods

2009-08-20 Thread Tom Lane
Greg Stark writes: > On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane wrote: >> I don't believe it is possible to use a btree index for this purpose, >> because there just isn't a way to express "overlaps" as a total order. > That's true for the general case of indexing ranges but I don't think > that's

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Martijn van Oosterhout
On Wed, Aug 19, 2009 at 03:03:28AM -0400, Stephen Cook wrote: > Let's say I have a function that needs to collect some data from various > tables and process and sort them to be returned to the user. > > In general, would it be better to create a temporary table in that > function, do the work

Re: [GENERAL] Generating random unique alphanumeric IDs

2009-08-20 Thread Ivan Sergio Borgonovo
On Thu, 20 Aug 2009 13:34:51 +0100 Thom Brown wrote: Correcting myself. a) it is a bad idea to pad an hex with an hex... so I should still find a quick way to change representation to [g-z] for the padding characters... or just pad with a constant string. select lpad( to_hex(feistel_encrypt(10))

Re: [GENERAL] unique index for periods

2009-08-20 Thread Greg Stark
On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane wrote: > I don't believe it is possible to use a btree index for this purpose, > because there just isn't a way to express "overlaps" as a total order. That's true for the general case of indexing ranges but I don't think that's true for the case where ove

[GENERAL] Connection name on ECPGdeallocate ?

2009-08-20 Thread leif
Hi guys, What is the reason for the ecpglib function ECPGdeallocate() (with call generated by the ecpg program) to have a connection_name parameter, when the ecpg program generates an error message, but generates 'correct' code ? This is if you put a connection name on the DEALLOCATE PREP

Re: [GENERAL] Monitoring the sequence cycles

2009-08-20 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I'm looking for a way to track the wrap arounds of cycle sequences. > > I also c

Re: [GENERAL] Clustering with enough work_mem: copy heap in mem?

2009-08-20 Thread Alvaro Herrera
Scara Maccai wrote: > I mean: there's access exclusive lock on the table while clustering, > so I don't see any problem in doing it... this way you could > > - avoid sorting (which is what is used in the method "create newtable > as select * from oldtable order by mycol", and can be slow with 15

Re: [GENERAL] Clustering with enough work_mem: copy heap in mem?

2009-08-20 Thread Scara Maccai
> I've found it easier to select everything into another > table, truncate > the original table, then insert the rows as: that takes 50 seconds of pure sorting and 8GB of ram to sort; my method doesn't require more memory than the size of the heap table, and no sorting, since the index is alread

Re: [GENERAL] Clustering with enough work_mem: copy heap in mem?

2009-08-20 Thread Scott Marlowe
On Thu, Aug 20, 2009 at 8:28 AM, Scara Maccai wrote: > Hi, > > I have a table with 15M rows. Table is around 5GB on disk. > > Clustering the table takes 5 minutes. > > A seq scan takes 20 seconds. > > I guess clustering is done using a seq scan on the index and then fetching > the proper rows in t

[GENERAL] Clustering with enough work_mem: copy heap in mem?

2009-08-20 Thread Scara Maccai
Hi, I have a table with 15M rows. Table is around 5GB on disk. Clustering the table takes 5 minutes. A seq scan takes 20 seconds. I guess clustering is done using a seq scan on the index and then fetching the proper rows in the heap. If that's the case, fetching random rows on disk is the caus

Re: [GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Tom Lane
Jorge Daine Quiambao writes: > I keep getting...  "ERROR: could not access file "$libdir/xxid": No such file > or > directory" whenever I create a new cluster. I've checked the pg directory and > the xxid files are in shared folder. The "no such file" complaint might refer to some library needed

Re: [GENERAL] unique index for periods

2009-08-20 Thread Tom Lane
Gerhard Heift writes: > I try to create an unique index for a (time)period, and my goal is to > prevent two overlapping periods in a row. > To use the btree index I added a compare function: >return > CASE > WHEN $1.next <= $2.first THEN -1 > WHEN $2.next <= $1.first

Re: [GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Scott Marlowe
Whoops, I meant if you're on windows, uninstall any antivirus then see if the problem goes away Too early in the morning apparently. On Thu, Aug 20, 2009 at 6:03 AM, Jorge Daine Quiambao wrote: > > Yes, that's how I did it uninstall everything first then install. I use > Windows Vista > > >> Hi,

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Jasen Betts
On 2009-08-19, Stephen Cook wrote: > Let's say I have a function that needs to collect some data from various > tables and process and sort them to be returned to the user. plpgsql functions don't play well with temp tables IME. there are work-arounds and they are ugly. if you caus use a differ

Re: [GENERAL] PL/PGSQL: why IF test the whole condition before failing or not?

2009-08-20 Thread Jasen Betts
On 2009-08-18, Suporte PK wrote: > Hi list, > > I'm having trouble with - believe me! - the IF operator on a PL/PGSQL > function used by a trigger. > > I'm using one unique function to process the three triggers events > (delete, update and insert), but when I reference OLD or NEW on a IF > CON

Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-20 Thread Sam Mason
On Thu, Aug 20, 2009 at 01:03:47PM +, Jasen Betts wrote: > On 2009-08-20, Randal L. Schwartz wrote: > > Exactly! If you don't want to use the 950-character regex, DON'T DO > > ANYTHING AT ALL. Far simpler. > > Or do an MX lookup on the domain part (or a partial attempt to route > mail*) bef

Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-20 Thread Jasen Betts
On 2009-08-20, Randal L. Schwartz wrote: >> "Clemens" == Clemens Schwaighofer >> writes: > >Clemens> I am not going to defend any regex here, but in my opinion it helps on >Clemens> what I want to see in email addresses. >Clemens> Yes it fails on mobile, but I have not yet seen one. > >

Re: [GENERAL] Best database model for canvassing (and analysing) opinion

2009-08-20 Thread Sebastian Tennant
Quoth Sam Mason : [...] > The only table that's really needed to solve your original problem would > be the last one, but the others provide all the checks that the data > is actually going in correctly and may or may not be useful depending > on your problem. The main thing to notice is lots of

Re: [GENERAL] Re: Unit conversion database (was: multiple paramters in aggregate function)

2009-08-20 Thread Karsten Hilbert
On Thu, Aug 20, 2009 at 12:06:19PM +, Jasen Betts wrote: > what is "vv" Vice versa, I'd assume. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to you

Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-20 Thread Jasen Betts
On 2009-08-19, Clemens Schwaighofer wrote: > On Wed, Aug 19, 2009 at 02:11, Randal L. Schwartz > wrote: >>> "Andre" == Andre Lopes writes: >> >> Andre> I'm developing a function with some checks, for example... to check >> if the >> Andre> e-mail is valid or not. >> >> How are you hoping to

Re: [GENERAL] multiple paramters in aggregate function

2009-08-20 Thread Karsten Hilbert
On Thu, Aug 20, 2009 at 03:30:00PM +0300, Sim Zacks wrote: > In other words, I have a conversion table of all different units. If > there is no conversion between 2 units (such as volume and area) then > the sum returns null. > > > Shouldn't that return NULL IOW unkno

Re: [GENERAL] Generating random unique alphanumeric IDs

2009-08-20 Thread Thom Brown
> > > Since I'm then converting to_hex to shorten the string I was > thinking to add some more bits of randomness since eg. > > to_hex(10) = 'a' > > In the line of > select lpad( > to_hex(feistel_encrypt(10)),7 , to_hex((rand()*2^31)::int) > ); > > I was wondering if there is any better way to ge

Re: [GENERAL] Unit conversion database (was: multiple paramters in aggregate function)

2009-08-20 Thread Karsten Hilbert
On Wed, Aug 19, 2009 at 08:31:17PM +0200, Alban Hertroys wrote: > He he, all right then! There certainly are some things left to > improve. One thing I noticed from the links you sent is that I > ignored a few units used in medicine assuming they were deprecated > ages ago - apparently not... Ah,

Re: [GENERAL] multiple paramters in aggregate function

2009-08-20 Thread Sim Zacks
In other words, I have a conversion table of all different units. If there is no conversion between 2 units (such as volume and area) then the sum returns null. Shouldn't that return NULL IOW unknown ? Karsten I am not familiar with returning unknown. I know that accord

Re: [GENERAL] multiple paramters in aggregate function

2009-08-20 Thread Karsten Hilbert
On Thu, Aug 20, 2009 at 10:36:37AM +0300, Sim Zacks wrote: > In other words, I have a conversion table of all different units. If > there is no conversion between 2 units (such as volume and area) then > the sum returns null. Shouldn't that return NULL IOW unknown ? Karsten -- GPG key ID E40713

[GENERAL] Re: Unit conversion database (was: multiple paramters in aggregate function)

2009-08-20 Thread Jasen Betts
On 2009-08-19, Alban Hertroys wrote: > On 19 Aug 2009, at 19:20, Karsten Hilbert wrote: > >> Alban, >> >> I think having an installable schema for units of measure with >> definitions and functions would be a great addition to PostgreSQL. > > Karsten, > > Thanks for the praise and the links. > >>

Re: [GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Jorge Daine Quiambao
Yes, that's how I did it uninstall everything first then install. I use Windows Vista > Hi, > > I keep getting...  "ERROR: could not access file "$libdir/xxid": No such > file or directory" whenever I create a new cluster. I've checked the pg > directory and the xxid files are in shared folder.

Re: [GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Scott Marlowe
On Thu, Aug 20, 2009 at 3:08 AM, Jorge Daine Quiambao wrote: > Hi, > > I keep getting...  "ERROR: could not access file "$libdir/xxid": No such > file or directory" whenever I create a new cluster. I've checked the pg > directory and the xxid files are in shared folder. > > I've installed PG 8.4 an

[GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-20 Thread Ivan Sergio Borgonovo
I've create table pr( code varchar(16) primary key, ... ); create sequence pr_code_seq owned by pr.code; -- uh! pr.code will *mostly* be obtained as to_hex(feistel_encrypt(nextval('pr_code'))) and sometimes 'manually' inserting unique codes. actually stuff like: alter table pr drop column c

Re: [GENERAL] unique index for periods

2009-08-20 Thread Harald Fuchs
In article <20090820065819.ga2...@gheift.kawo1.rwth-aachen.de>, Gerhard Heift writes: > Hello, > I try to create an unique index for a (time)period, and my goal is to > prevent two overlapping periods in a row. > ... > Is there another solution to solve my problem? Have a look at http://pgfoun

Re: R: [GENERAL] Field's position in Table

2009-08-20 Thread Sam Mason
On Thu, Aug 20, 2009 at 11:24:49AM +0200, vinny wrote: > I can't really think of any real reason to put the field at a > particular position, applications don't reallty care about the order > of fields. Because it's very convenient for ad-hoc queries! PG currently assumes that the column order is

Re: [GENERAL] Generating random unique alphanumeric IDs

2009-08-20 Thread Ivan Sergio Borgonovo
On Mon, 17 Aug 2009 12:37:33 +0200 "Daniel Verite" wrote: > http://archives.postgresql.org/pgsql-general/2009-07/msg00194.php As an exercise I wrote the decrypt version create or replace function feistel_encrypt(value int) returns int as $$ declare l1 int; l2

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Sam Mason
On Wed, Aug 19, 2009 at 08:10:14PM -0400, Stephen Cook wrote: > I've decided on some type of table storage because basically I'm > combining information from several different tables (some of which need > to recursively get other rows) and massaging it and sorting it in ways > far too convoluted

[GENERAL] Generate LaTeX doc from PostgreSQL (autodoc)?

2009-08-20 Thread Wolfgang Keller
Hello, what would be the easiest way to generate documentation for a PostgreSQL database in LaTeX/LyX format? Autodoc doesn't seem to support LaTeX output directly... TIA, Sincerely, Wolfgang -- NO "Courtesy Copies" PLEASE! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.

Re: R: [GENERAL] Field's position in Table

2009-08-20 Thread vinny
On Thu, 20 Aug 2009 09:21:25 + (GMT), Scara Maccai wrote: >> When adding a new field in the existing table, i >> want to add the filed in a particular position. > > I'm afraid the only way would be re-writing the whole table (pseudo sql): > > BEGIN; > create table newtable as select field1,

R: [GENERAL] Field's position in Table

2009-08-20 Thread Scara Maccai
> When adding a new field in the existing table, i > want to add the filed in a particular position. I'm afraid the only way would be re-writing the whole table (pseudo sql): BEGIN; create table newtable as select field1, 'newfield default value', field2 from old_table; create_all_indexes on ne

Re: [GENERAL] Field's position in Table

2009-08-20 Thread John R Pierce
Kalai R wrote: Hi , I have a problem in Postgres. When adding a new field in the existing table, i want to add the filed in a particular position. Is there any way to change the fields position in the table. Any Solution to this problem would be much appreciated. don't use * in SELECT stat

[GENERAL] ERROR: could not access file "$libdir/xxid": No such file or directory

2009-08-20 Thread Jorge Daine Quiambao
Hi, I keep getting...  "ERROR: could not access file "$libdir/xxid": No such file or directory" whenever I create a new cluster. I've checked the pg directory and the xxid files are in shared folder. I've installed PG 8.4 and Slony-I 2.0.2-1 properly using one-click-installer and stack builder.

[GENERAL] Field's position in Table

2009-08-20 Thread Kalai R
Hi , I have a problem in Postgres. When adding a new field in the existing table, i want to add the filed in a particular position. Is there any way to change the fields position in the table. Any Solution to this problem would be much appreciated. Thanks Softlinne

Re: [GENERAL] multiple paramters in aggregate function

2009-08-20 Thread Sim Zacks
> My query contains select .., > sum_unitvalues(qty,unitid),sum_units(unitid),... > then the units returned do not have to be known in advance, which is > important in this specific project. > To give an example of my required result set: unitid 1 = mm 2 = inch 3 = ft 4 = gram create table te

Re: [GENERAL] multiple paramters in aggregate function

2009-08-20 Thread Sim Zacks
>> That would be true if all units were always convertible to mm, but we >> have volume also, we also have feet etc.. So that the easiest and > > How did you plan on solving that in your multiple-argument aggregate? > Fake their value by adding 0? That's no different for my suggested > solution. W