Re: [GENERAL] Extraordinarily slow!!

2005-09-24 Thread Peter Fein
not knowing what's running, it's fairly trivial to deduce the compile time options based on USE flags. Heck, you've even got full compile/install logs if you want them... Just saying. ;) -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if

Re: [GENERAL] Asychronous database replication

2005-09-16 Thread Peter Fein
e C which is a few countries away any time soon. Basically, I don't think you need to update all nodes with every record immediately. For some early-morning reason, this made me think of distributed version control, but I'm not entirely sure how one would use it in this case. S

[GENERAL] Code Tables: varchar or serial pkey?

2005-09-13 Thread Peter Fein
my_table, which may have 100's of millions of rows down the road. Are these good reasons? I'm thinking about switching to using the varchar col as the pkey/fkey just to make my coding easier. How do people do this sort of thing? TIA. --Pete -- Peter Fein [EMAIL PROTEC

Re: [GENERAL] back references using regex

2005-09-08 Thread Peter Fein
o.foo.xyz' FROM > $$((\w+)\.\2)$$); > > What I basically want to do is have a slice function > like Python, where I can slice out items from a \s, \. > or \n\n separated list. You could always just write it in pl/python... -- Peter Fein [EMAIL PROTECTED]

Re: [GENERAL] plpython function with dictionary as function argument?

2005-08-19 Thread Peter Fein
e able to execute > CONN.execute("select * from myfunction (someDict)") Marshal someDict and unmarshal it in your function. Marshal is *very* fast. -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you'r

[GENERAL] Timing out connections?

2005-08-18 Thread Peter Fein
faqs & haven't been able to find an answer. The best we could come up with was tunneling over SSH and lowering sshd's timeout setting, but this seems less than ideal. TIA. --Pete -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you&#

Re: [GENERAL] Finding nearest numeric value

2005-08-17 Thread Peter Fein
myval. > > You can always sort the results by abs(myval) then if you don't want to > handle two values in the application layer. > Ahh, should that be >= and <= ? ;) -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not

Re: [GENERAL] Finding nearest numeric value

2005-08-17 Thread Peter Fein
to some CONSTANT (where you > replace constant with a number), try: > > select *,(number_column - CONSTANT)^2 as d from tablename order by d limit > 1; > Save yourself some cycles - use abs() instead of exponentiation. -- Peter Fein [EMAIL PROTECTED]

Re: [GENERAL] No PUBLIC access by default?

2005-08-12 Thread Peter Fein
Martijn van Oosterhout wrote: > On Fri, Aug 12, 2005 at 08:34:23AM -0500, Peter Fein wrote: > >>Ok. ;) A little further investigation revealed that template0 gives the >>same result. It's potentially confusing that template0 is initialized >>this way - I couldn

Re: [GENERAL] No PUBLIC access by default?

2005-08-12 Thread Peter Fein
Tom Lane wrote: > Peter Fein <[EMAIL PROTECTED]> writes: > >>If I read my ACL's correctly, =UC/postgres means full access for PUBLIC. >> Why is that happening? > > > Because that's the way it's set up in template1. CREATE DATABASE just > cop

Re: [GENERAL] No PUBLIC access by default?

2005-08-11 Thread Peter Fein
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > >>Actually, that last grant is implicit. When an ACL is found to be null, >>it's considered to have a grant to public. > > > No, it's considered to be whatever the default for the object type is. > Read the GRANT manual page. I'm o

[GENERAL] No PUBLIC access by default?

2005-08-11 Thread Peter Fein
Hi all- Is there any way to disable PUBLIC access by default? When I create a new object (table, function, etc.), it has no ACL, as expected. However, the first time I run: GRANT ALL ON FUNCTION foo() to GROUP developers; Postgress seems to do: GRANT ALL ON FUNCTION foo() to PUBLIC; I assume

Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Peter Fein
Kevin Murphy wrote: > I thought this might be helpful in the future to other duffers such as > myself. > > The following is my big contribution to the documentation of the use of > scalar subqueries ;-): > > You have to wrap a scalar subquery in its own parentheses even where you > might think it

Schema Pivileges was Re: [GENERAL] Alter privileges for all tables

2005-08-01 Thread Peter Fein
note, is revoking all on a schema sufficient to prevent users (or, say, group public) from accessing anything w/i that schema, or do I need to explicitly set rights on all of the objects w/i the schema? -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically

Re: [GENERAL] Privileges needed by pg_autovacuum?

2005-07-23 Thread Peter Fein
Peter Fein wrote: > I've password protected the 'postgres' account (to enable secure remote > access) and I don't want to store the password on the local file system. > I therefore want to create a separate account for use by pg_autovacuum > (locked down in pg_hba.

[GENERAL] Privileges needed by pg_autovacuum?

2005-07-23 Thread Peter Fein
What are the minimum set of privileges needed by pg_autovacuum? I've searched extensively & can't find an answer. -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
python function (JOINs, etc.). This seems ugly/slow. The whole mess eventually goes in to a trigger, so doing it client-side isn't an option. -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldma

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
- IIRC, something was mentioned about the SQL VALUES construct being unimplemented. -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman ---(end of broadcast)

Re: [GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
Joshua D. Drake wrote: > Peter Fein wrote: > >> Is it possible to return a SETOF text or a text[] from pl/python? >> >> I've got the following test cases: >> >> CREATE OR REPLACE FUNCTION arf() >> RETURNS text[] LANGUAGE plpythonu AS >>

[GENERAL] Return SETOF or array from pl/python

2005-07-15 Thread Peter Fein
$$return ["one", "two", "three"]$$; SELECT * FROM srf(); srf - ['one', 'two', 'three'] (1 row) SELECT srf(); Never returns. I can obviously use something like arf2 (manually stringifying w/i

Re: [GENERAL] Quotation marks in queries

2005-07-14 Thread Peter Fein
Things don't look very nice with quotes all over the place. -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman ---(end of broadcast)--- TIP

[GENERAL] Infix Function?

2005-06-26 Thread Peter Fein
hought I saw a way to do this, but now I can't find it in the manual... TIA. --Pete -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman ---(end of broadcast)

Re: [GENERAL] How to compare the schemas ?

2005-06-23 Thread Peter Fein
/reading through Usenet, please send an appropriate >subscribe-nomail command to [EMAIL PROTECTED] so that your >message can get through to the mailing list cleanly -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you&#x

Re: [GENERAL] Error column "sys" does not exist

2005-06-17 Thread Peter Fein
Peter Fein wrote: > On logging in from PGAdmin over SSL, one of my fellow developers gets > the following message: > > Error column "sys" does not exist > > He can see a list of databases, but no schemas. I'm not able to > replicate the problem. TIA.

[GENERAL] Error column "sys" does not exist

2005-06-17 Thread Peter Fein
On logging in from PGAdmin over SSL, one of my fellow developers gets the following message: Error column "sys" does not exist He can see a list of databases, but no schemas. I'm not able to replicate the problem. TIA. --Pete -- Peter Fein [

Re: [GENERAL] Hash Function: MD5 or other?

2005-06-14 Thread Peter Fein
Bruno Wolff III wrote: > On Tue, Jun 14, 2005 at 08:33:34 -0500, > Peter Fein <[EMAIL PROTECTED]> wrote: > >>Knowing the specifics of the data I'm putting in sometext, a halfway >>decent hash function would make collisions so rare as to make the chance >>

Re: [GENERAL] Hash Function: MD5 or other?

2005-06-14 Thread Peter Fein
Alex Stapleton wrote: > > On 13 Jun 2005, at 23:49, Peter Fein wrote: > > >> Hi- >> >> I wanted to use a partially unique index (dependent on a flag) on a TEXT >> column, but the index row size was too big for btrees. See the thread >> "index

[GENERAL] Hash Function: MD5 or other?

2005-06-13 Thread Peter Fein
g a function from pl/something? Figures on collision rates would be nice as well - the typical chunk of text is probably 1k-8k. Thanks! -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman

Re: [GENERAL] Version Control?

2005-06-11 Thread Peter Fein
Peter Fein wrote: > As an uninformed, off-the-wall idea, could one compare snapshots of the > system tables to generate these diffs? I know next-to-nothing about > these, but it seems like they'd contain the info you'd need. Here's another nutty idea: Could one create a (c

Re: [GENERAL] Version Control?

2005-06-11 Thread Peter Fein
Karsten Hilbert wrote: > On Fri, Jun 10, 2005 at 10:38:52AM -0500, Peter Fein wrote: > > >>This is interesting... You'd want to be able to generate either a bunch >>of CREATEs to create a schema from scratch or a 'patch' of ALTER >>commands to move b/

Re: [GENERAL] Version Control?

2005-06-10 Thread Peter Fein
one would want to install by hand (to get the latest version or whatever). I recently got a script to do something similar for MySQL by parsing the output of 'show create table'. It's pretty simple & not full-featured. I need to check with the author before

[GENERAL] Version Control?

2005-06-09 Thread Peter Fein
Hi- Any general tips on using version control (CVS, SVN) while doing database design? My thought was to do a text-mode dump (including populated code tables) from PGAdmin. How do people do this? -- Peter Fein [EMAIL PROTECTED] 773-575-0694 Basically, if you&#x

Re: [GENERAL] Preventing Multiple Inheritance

2005-06-03 Thread Peter Fein
Tom Lane wrote: > Peter Fein <[EMAIL PROTECTED]> writes: > >>Let's say I have a base table B (with a PK id, say) and two derived >>tables D1 & D2 (with different cols). For a given B.id, I'd like to >>allow only a corresponding row in *either* D1 or D2

[GENERAL] Preventing Multiple Inheritance

2005-06-03 Thread Peter Fein
l? My thought was to add a column inherits_to to B with a value indicating whether that row is really a D1 or a D2 and enforce it with appropriate CHECK constraints on each of the derived tables. Sorry if this is unclear... -- Peter Fein [EMAIL PROTECTED]

Re: [GENERAL] Test for array slice?

2005-06-03 Thread Peter Fein
Sean Davis wrote: > > On Jun 3, 2005, at 12:32 PM, Joe Conway wrote: > >> Peter Fein wrote: >> >>> I want to do something like this (pardon my pseudocode): >>> A=ARRAY[4, 5, 6, 7, 8] >>> B=ARRAY[5, 6] >>> is_sliceof(A, B), i.e., there ex

[GENERAL] Test for array slice?

2005-06-03 Thread Peter Fein
Hi- I want to do something like this (pardon my pseudocode): A=ARRAY[4, 5, 6, 7, 8] B=ARRAY[5, 6] is_sliceof(A, B), i.e., there exists a slice of A that equals B. My best thought ATM is to convert both to strings and use pattern matching - any better ideas? --Pete ---

Re: [GENERAL] JOIN on set of rows?

2005-05-11 Thread Peter Fein
On 05/11/05 08:22 AM CDT, Richard Huxton said: > Peter Fein wrote: > > Hiya- > > > > I need to do something like this: > > > > SELECT t1.symbol AS app_name, t2.outside_key AS app_id > > FROM t2 LEFT JOIN t1 ON t1.t2_id=t2.id AS my_join > > LEFT

Re: [GENERAL] JOIN on set of rows?

2005-05-10 Thread Peter Fein
On 05/10/05 06:17 PM CDT, Peter Fein <[EMAIL PROTECTED]> said: > Hiya- > > I need to do something like this: > > SELECT t1.symbol AS app_name, t2.outside_key AS app_id > FROM t2 LEFT JOIN t1 ON t1.t2_id=t2.id AS my_join > LEFT JOIN rows of arbitrary (app_name, ap

[GENERAL] JOIN on set of rows?

2005-05-10 Thread Peter Fein
from my app ;). I can't figure out how to create something that acts like a table with rows specified in the text of the query. A temporary table perhaps? I don't know much (anything) about these... Thanks! -- Peter Fein [EMAIL PROTECTED] 773-575-0694

Re: [GENERAL] Function to return number of words in a string?

2005-05-09 Thread Peter Fein
On 05/09/05 11:21 AM CDT, Peter Fein <[EMAIL PROTECTED]> said: > Hiya- > > I'm looking for a function to return the number of words in a string, > split on whitespace. I'm coming from python, so I may just write it > in that but I wanted to check first. In python

[GENERAL] Function to return number of words in a string?

2005-05-09 Thread Peter Fein
Hiya- I'm looking for a function to return the number of words in a string, split on whitespace. I'm coming from python, so I may just write it in that but I wanted to check first. In python, one would write: s="some string or other" len(s.split()) Tha