[GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Joe Kramer
Hello, I need to generate unique id which is not guessable unlike serial(integer) type. I need an id in format like md5 hash of random number. On top of that I need this id to be unique across multiple tables. Anyone had to solve this problem before? Can you post any recipes or best practices ple

[GENERAL] R: How to generate unique hash-type id?

2010-01-29 Thread Vincenzo Romano
Uuid? Il giorno 29 gen, 2010 9:20 m., "Joe Kramer" ha scritto: Hello, I need to generate unique id which is not guessable unlike serial(integer) type. I need an id in format like md5 hash of random number. On top of that I need this id to be unique across multiple tables. Anyone had to solve t

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Adrian von Bidder
Hi, On Friday 29 January 2010 09.20:33 Joe Kramer wrote: > I need to generate unique id which is not guessable unlike > serial(integer) type. I need an id in format like md5 hash of random > number. > On top of that I need this id to be unique across multiple tables. Have a look at http://www.po

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Magnus Hagander
On Fri, Jan 29, 2010 at 10:31, Adrian von Bidder wrote: > > Hi, > > On Friday 29 January 2010 09.20:33 Joe Kramer wrote: >> I need to generate unique id which is not guessable unlike >> serial(integer) type. I need an id in format like md5 hash of random >> number. >> On top of that I need this id

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Joe Kramer
We have bunch of servers running the app and rebuilding postgres with support for ossp_uuid on all servers is time consuming. Is there a way of doing it without third party dependency like ossp_uuid? Should I just run md5(random number), will itbe the same ?. According to description it seems that

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Adrian von Bidder
On Friday 29 January 2010 11.21:00 Joe Kramer wrote: > We have bunch of servers running the app and rebuilding postgres with > support for ossp_uuid on all servers is time consuming. > Is there a way of doing it without third party dependency like > ossp_uuid? Should I just run md5(random number),

Re: [GENERAL] Problem after installing triggering function

2010-01-29 Thread Alban Hertroys
On 29 Jan 2010, at 2:06, Yan Cheng Cheok wrote: > CREATE OR REPLACE FUNCTION insert_table() > RETURNS void AS > $BODY$DECLARE >_impressions_by_day impressions_by_day; > BEGIN >INSERT INTO impressions_by_day(impressions ) VALUES(888) RETURNING * INTO > _impressions_by_day; > >RAISE

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread hubert depesz lubaczewski
On Fri, Jan 29, 2010 at 07:20:33PM +1100, Joe Kramer wrote: > I need to generate unique id which is not guessable unlike > serial(integer) type. I need an id in format like md5 hash of random > number. check this blogpost: http://www.depesz.com/index.php/2007/06/25/random-text-record-identifiers/

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Joe Kramer
Thanks for the answer, I am unable to use ossp_uuid due to package install and/or server rebuild requirement. So I am trying to roll my own, and digest(quote_literal(random()+random()), 'sha256'), 'hex') doesn't work: I have created this table and inserted 20 rows (two million). This is more

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Adrian von Bidder
On Friday 29 January 2010 12.51:20 Joe Kramer wrote: > So this means random()+random() is not random even within 2,000,000 > iterations! > Exactly the issue I wrote about: random() apparently doesn't deliver enough randomness. Even if it did: quote_literal(random() + random()) is ca. 14 to 16

Re: [GENERAL] Primary Key Increment Doesn't Seem Correct Under Table Partition

2010-01-29 Thread Alban Hertroys
On 29 Jan 2010, at 1:56, Yan Cheng Cheok wrote: > Isn't the primary constraint will implicitly create an index for day already? > > PRIMARY KEY (advertiser_id, day), Yes, but it's not a very efficient index to look for values of day if you don't provide a value for advertiser_id as well. See

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Wappler, Robert
On 2010-01-29, Joe Kramer wrote: > Thanks for the answer, > > I am unable to use ossp_uuid due to package install and/or server > rebuild requirement. > > So I am trying to roll my own, and > digest(quote_literal(random()+random()), 'sha256'), 'hex') doesn't work: > Your input value is a rand

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Ivan Sergio Borgonovo
On Fri, 29 Jan 2010 13:13:17 +0100 "Wappler, Robert" wrote: > I'd suggest to use some kind of sequence or something constructed > from the primary keys. But you may still see hash collisions > although the input is different. Concatenate /* ::text */ random() with something like: http://www.web

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Craig Ringer
On 29/01/2010 4:20 PM, Joe Kramer wrote: Hello, I need to generate unique id which is not guessable unlike serial(integer) type. I need an id in format like md5 hash of random number. On top of that I need this id to be unique across multiple tables. Anyone had to solve this problem before? Can

[GENERAL] ODBC mac os

2010-01-29 Thread Enrico Pirozzi
Hi, I would like to find an odbc driver for mac os x, where I can find it? Thanks to all regards, Enrico -- That's one small step for man; one giant leap for mankind -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgres

Re: [GENERAL] ODBC mac os

2010-01-29 Thread Dave Page
On Fri, Jan 29, 2010 at 1:29 PM, Enrico Pirozzi wrote: > Hi, > I would like to find an odbc driver for mac os x, > where I can find it? > > Thanks to all If you're running the one-click PG installer, you can install the ODBC driver using StackBuilder. -- Dave Page EnterpriseDB UK: http://www.e

[GENERAL] Behavior of "at time zone"

2010-01-29 Thread Andrew Crouch
Hi there, I'm looking to use the "at time zone" language feature, however the results below don't really agree with my expectations. Is this a bug in 8.4 or am I misinterpreting the results? If it is a bug, has it been fixed in the development releases? psql (8.4.0) Type "help" for

Re: [GENERAL] Behavior of "at time zone"

2010-01-29 Thread Adrian Klaver
On Friday 29 January 2010 5:34:04 am Andrew Crouch wrote: > Hi there, > I'm looking to use the "at time zone" language feature, however > the results below don't really agree with my expectations. Is this a bug > in 8.4 or am I misinterpreting the results? If it is a bug, has it been > f

[GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 While looking into a failed check_postgres check, I found a problem with the canonical versions page here: http://www.postgresql.org/versions.rss It only goes back to 8.0, but as far as I know, 7.4 is not unsupported yet, so that page should b

Re: [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Magnus Hagander
(adding pgsql-www, isn't this more a www question than a general postgresql usage question?) 2010/1/29 Greg Sabino Mullane : > > > While looking into a failed check_postgres check, I found a problem > with the canonical versions page here: > > http://www.postgresql.org/versions.rss > > It only go

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Guillaume Lelarge
Le 29/01/2010 15:51, Magnus Hagander a écrit : > (adding pgsql-www, isn't this more a www question than a general > postgresql usage question?) > > > 2010/1/29 Greg Sabino Mullane : >> >> >> While looking into a failed check_postgres check, I found a problem >> with the canonical versions page he

Re: [GENERAL] Output float number with hex format

2010-01-29 Thread 沈雷
Thank you for the reply. After 3 hours trials and reading the source code of Postgres backend, now I can figure out a way to transfer float data from sever to client and then write back to server *without lose any precision*. At server part, it uses strtod to convert received string to float valu

Re: [GENERAL] Amazon EC2 CPU Utilization

2010-01-29 Thread Rodger Donaldson
Mike Bresnahan wrote: > I can understand that I will not get as much performance out of a EC2 instance as a dedicated server, but I don't understand why top(1) is showing 50% CPU utilization. If it were a memory speed problem wouldn't top(1) report 100% CPU utilization? A couple of points: top

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Dave Page
On Fri, Jan 29, 2010 at 2:53 PM, Guillaume Lelarge wrote: > Le 29/01/2010 15:51, Magnus Hagander a écrit : >> (adding pgsql-www, isn't this more a www question than a general >> postgresql usage question?) >> >> >> 2010/1/29 Greg Sabino Mullane : >>> >>> >>> While looking into a failed check_postg

Re: [GENERAL] dynamic crosstab

2010-01-29 Thread Andy Colson
On 1/28/2010 5:51 PM, Pierre Chevalier wrote: while ( my @list = $get->fetchrow_array) { print join(',', @list), "\n"; } It throws some insulting messages, though: Use of uninitialized value $list[5] in join or string at ./crosstab_perl.pl line 24. Use of uninitialized value $list[6] in join

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Devrim GÜNDÜZ
On Fri, 2010-01-29 at 15:08 +, Dave Page wrote: > > Perhaps because you only display five releases in the "Latest > Releases" > > part of the front page? which means 8.0 to 8.4. > > Yes. iirc, that was the reason. Is it possible to add all (7.3+) versions to versions.rss, but show only top 5

[GENERAL] how to look for duplicate rows?

2010-01-29 Thread zach cruise
i have to clean a table that looks like so: create table test (sn integer, fname varchar(10), lname varchar(10)); insert into test values (1, 'adam', 'lambert'); insert into test values (2, 'john', 'mayer'); insert into test values (3, 'john', 'mayer'); insert into test values (4, 'mary', 'kay');

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Joshua D. Drake
On Fri, 2010-01-29 at 17:49 +0200, Devrim GÜNDÜZ wrote: > On Fri, 2010-01-29 at 15:08 +, Dave Page wrote: > > > Perhaps because you only display five releases in the "Latest > > Releases" > > > part of the front page? which means 8.0 to 8.4. > > > > Yes. iirc, that was the reason. > > Is it

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Devrim GÜNDÜZ
On Fri, 2010-01-29 at 08:44 -0800, Joshua D. Drake wrote: > > Is it possible to add all (7.3+) versions to versions.rss, but show > only > > top 5 versions? > > 7.3 is not supported. I know. But it would be a chance to remind people to upgrade their installations. -- Devrim GÜNDÜZ, RHCE Command

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Dave Page
2010/1/29 Devrim GÜNDÜZ : > On Fri, 2010-01-29 at 15:08 +, Dave Page wrote: >> > Perhaps because you only display five releases in the "Latest >> Releases" >> > part of the front page? which means 8.0 to 8.4. >> >> Yes. iirc, that was the reason. > > Is it possible to add all (7.3+) versions to

Re: [GENERAL] how to look for duplicate rows?

2010-01-29 Thread Raymond O'Donnell
On 29/01/2010 16:40, zach cruise wrote: > i have to clean a table that looks like so: > > create table test (sn integer, fname varchar(10), lname varchar(10)); > insert into test values (1, 'adam', 'lambert'); > insert into test values (2, 'john', 'mayer'); > insert into test values (3, 'john', 'm

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Joshua D. Drake
On Fri, 2010-01-29 at 18:50 +0200, Devrim GÜNDÜZ wrote: > On Fri, 2010-01-29 at 08:44 -0800, Joshua D. Drake wrote: > > > Is it possible to add all (7.3+) versions to versions.rss, but show > > only > > > top 5 versions? > > > > 7.3 is not supported. > > I know. But it would be a chance to remin

Re: [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 >> yet, so that page should be listing 7.4.27. Further, shouldn't we be keeping >> even 'unsupported' versions on this page, so (e.g. case of check_postgres.pl) >> cl

Re: [GENERAL] Amazon EC2 CPU Utilization

2010-01-29 Thread Mike Bresnahan
In an attempt to determine whether top(1) is lying about the CPU utilization, I did an experiment. I fired up a EC2 c1.xlarge instance and ran pgbench and a tight loop in parallel. -bash-4.0$ uname -a Linux domu-12-31-39-00-8d-71.compute-1.internal 2.6.31-302-ec2 #7-Ubuntu SMP Tue Oct 13 19:55:22

[GENERAL] Learning more about attaches

2010-01-29 Thread Gauthier, Dave
Hi: PG V8.3.4 running on Linux. I have a DB with a bunch of users attached as gleaned from "ps auxww | grep postgres". How can I learn more about these users, who they are if coming in via the net, what kind of resources they are using, what they are running, how I can kill them? I'm open to

Re: [GENERAL] Learning more about attaches

2010-01-29 Thread Chris Ernst
Well.. the "quick and dirty" start would be: SELECT * FROM pg_stat_activity; As for a good management tool, I would recommend pgAdmin3: http://www.pgadmin.org/ - Chris On 01/29/2010 12:34 PM, Gauthier, Dave wrote: > Hi: > > > > PG V8.3.4 running on Linux. > > > > I have a D

Re: [GENERAL] Amazon EC2 CPU Utilization

2010-01-29 Thread John R Pierce
top is not the be-all and end-all of analysis tools. I'm sure you know that, but it bears repeating. More importantly, in a virtualised environment the tools on the inside of the guest don't have a full picture of what's really going on. Indeed, you have hit the nail on the head. does anyon

Re: [GENERAL] Behavior of "at time zone"

2010-01-29 Thread Andrew Crouch
Hi Adrian, Thanks for your reply. However, I still don't fully understand why SET TIMEZONE TO and AT TIME ZONE behave differently. Morever the /usr/share/pgsql/timezonesets/America.txt (POSIX) specifies the BRST timezone with a two hour negative offset. Unless I'm missing something

[GENERAL] Possible to set postgres in case insensitive mode ?

2010-01-29 Thread Moe
Is it possible to set postgres in case insensitive mode ? If so, how? Thanks / Moe

Re: [GENERAL] Possible to set postgres in case insensitive mode ?

2010-01-29 Thread Joshua D. Drake
On Fri, 2010-01-29 at 23:52 +0200, Moe wrote: > Is it possible to set postgres in case insensitive mode ? I assume you mean the issue where postgres folds all case of objects to lower if they are not "". No. Joshua D. Drake -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.

Re: [GENERAL] Possible to set postgres in case insensitive mode ?

2010-01-29 Thread Bill Moran
In response to Moe : > Is it possible to set postgres in case insensitive mode ? > > If so, how? Keywords are always case-insensitive. Identifiers are case-insensitive unless you surround them with "". Strings are case-sensitive unless you use ILIKE or similar methods of comparison. All of th

[GENERAL] storing windows path strings

2010-01-29 Thread Scott Frankel
Hi all, What's the proper way to store directory path strings in a table, especially ones with backslashes like windows? I'm currently using a prepared statement with bind value. Do I need to pre-parse all user entries to identify any backslash characters before passing the string to my

Re: [GENERAL] storing windows path strings

2010-01-29 Thread Cédric Villemain
2010/1/29 Scott Frankel : > > Hi all, > What's the proper way to store directory path strings in a table, especially > ones with backslashes like windows? > I'm currently using a prepared statement with bind value.  Do I need to > pre-parse all user entries to identify any backslash characters befo

Re: [GENERAL] Behavior of "at time zone"

2010-01-29 Thread Adrian Klaver
On Friday 29 January 2010 1:04:59 pm Andrew Crouch wrote: > Hi Adrian, > Thanks for your reply. However, I still don't fully understand > why SET TIMEZONE TO and AT TIME ZONE behave differently. Morever the > /usr/share/pgsql/timezonesets/America.txt (POSIX) specifies the BRST > timezo

Re: [pgsql-www] [GENERAL] Versions RSS page is missing version(s)

2010-01-29 Thread Devrim GÜNDÜZ
On Fri, 2010-01-29 at 09:25 -0800, Joshua D. Drake wrote: > > > > I know. But it would be a chance to remind people to upgrade their > > installations. > > An arbitrary listing won't do that. Depends. -- Devrim GÜNDÜZ, RHCE Command Prompt - http://www.CommandPrompt.com devrim~gunduz.org, devr

Re: [GENERAL] storing windows path strings

2010-01-29 Thread Scott Frankel
Excellent! Mild testing so far, but it seems to work. Thanks! Scott On Jan 29, 2010, at 3:00 PM, Cédric Villemain wrote: 2010/1/29 Scott Frankel : Hi all, What's the proper way to store directory path strings in a table, especially ones with backslashes like windows? I'm currently us

Re: [GENERAL] How to generate unique hash-type id?

2010-01-29 Thread Joe Kramer
Thanks for that link Depesz! It worked, I've run ALTER TABLE with your function and didn't have collisions. I guess it's more bulletproof because random() is called not once, but for every character therefore reducing possibility of collision by multitude of number of bytes in hash. CREATE OR REPL

Re: [GENERAL] Possible to set postgres in case insensitive mode ?

2010-01-29 Thread Scott Marlowe
On Fri, Jan 29, 2010 at 2:52 PM, Moe wrote: > Is it possible to set postgres in case insensitive mode ? > > If so, how? What part, exactly, do you want to be case insensitive? I assume you mean a text / varchar type? Look for citext, I believe it's a contrib module, until 9.0 is out, which will

Re: [GENERAL] Possible to set postgres in case insensitive mode ?

2010-01-29 Thread Scott Marlowe
On Fri, Jan 29, 2010 at 7:40 PM, Scott Marlowe wrote: > On Fri, Jan 29, 2010 at 2:52 PM, Moe wrote: >> Is it possible to set postgres in case insensitive mode ? >> >> If so, how? > > What part, exactly, do you want to be case insensitive?  I assume you > mean a text / varchar type?  Look for cite