Re: [GENERAL] Stuck vacuum...

2009-10-10 Thread Mike Diehl
On Friday 09 October 2009 08:22:52 pm Tom Lane wrote: > Mike Diehl writes: > > I'm doing a routine vacuum on my database and it seems to be getting > > "stuck." > > > > I've got a "servers" table with only a few rows and columns in it and > > this is what vacuum has to say: > > > > # VACUUM ANALYZ

Re: [GENERAL] Access dynamic NEW.column_name in trigger?

2009-10-10 Thread Scott Marlowe
On Fri, Oct 9, 2009 at 8:23 PM, Nick wrote: > This is a very abbr version of my problem, but what would be the best > way to do this... > > DECLARE >  column_name_var TEXT; > BEGIN >  RETURN NEW.column_name_var; > END; plpgsql doesn't really do dynamic column names. You'll need to implement it i

Re: [GENERAL] automated row deletion

2009-10-10 Thread Jasen Betts
On 2009-10-07, Dave Huber wrote: > --_000_7CDADB576E07AC4FA71E1B12566C9126540E0A0C34ltimb1LTIcom_ > Content-Type: text/plain; charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > A colleague gave me the following query to run: > > DELETE FROM data_log_20msec_table WHERE (log_id IN

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-10 Thread Jasen Betts
On 2009-10-08, Mike Christensen wrote: > (Sorry for the super-easy question) > > I want to store sales tax (as a percent) in the DB, such as 9.5%. > What's the best data type for this? real, or numeric, probably numeric. > I'm guessing numeric(2,3) should be fine, yes? depends on the range of

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-10 Thread Jasen Betts
On 2009-10-09, Peter Eisentraut wrote: > On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote: >> Domains are basically type aliases with an optional CHECK clause, so >> you could do something like: >> >> CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0); >> >> Then, yo

Re: [GENERAL] bulk inserts

2009-10-10 Thread Jasen Betts
On 2009-09-29, Alan Hodgson wrote: > On Tuesday 29 September 2009, Sam Mason wrote: >> ?? I'm not sure what you're implying about the semantics here, but it >> doesn't seem right. COPY doesn't somehow break out of ACID semantics, >> it's only an *optimization* that allows you to get large quanti

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-10 Thread Roderick A. Anderson
Jasen Betts wrote: On 2009-10-09, Peter Eisentraut wrote: On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote: Domains are basically type aliases with an optional CHECK clause, so you could do something like: CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0); Th

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-10 Thread Christophe Pettus
On Oct 10, 2009, at 3:33 AM, Jasen Betts wrote: CREATE DOMAN sales_tax_rate AS DECIMAL CHECK (VALUE >= 0 AND VALUE <=1); why the latter check ( VALUE <=1 )? Since this version has no scale on the DECIMAL, the second check keeps it from being larger than 1.0, since it's presumably a percen

[GENERAL] Re: transaction ID wraparound - should I use 'VACUUM' or 'VACUUM FULL' ?

2009-10-10 Thread Michal Szymanski
On 10 Paź, 04:38, t...@sss.pgh.pa.us (Tom Lane) wrote: > Alvaro Herrera writes: > > Michal Szymanski wrote: > >> In old version of Postgres we have to execute 'VACUUM FULL' to solve > >> problem of  transaction ID wraparound, do we need to execute 'VACUUM > >> FULL' in Postgres 8.3 or 8.4 to avoid

[GENERAL] Building PG 8.4.1 with ossp-uuid on Centos 5.3

2009-10-10 Thread Christophe Pettus
Greetings, I'm attempting to build a version of PG 8.4.1 with the OSSP uuid libraries on Centos 5.3 (I'm building PG from source). I simply cannot seem to find the right libraries to install; even very promising candidates seem to be a different version than the one PG is expecting. Con

[GENERAL] Prepared statements with a variable number of parameters

2009-10-10 Thread Raymond O'Donnell
I'm using PDO in PHP for database access (actually Zend Framework), and following best practice by using parameters in prepared statements. My question is, what do people normally do when there's a variable number of parameters? - for example: select . where item_id in ( ... ); In this cas

Re: [GENERAL] Prepared statements with a variable number of parameters

2009-10-10 Thread Pavel Stehule
Hello 2009/10/10 Raymond O'Donnell : > I'm using PDO in PHP for database access (actually Zend Framework), and > following best practice by using parameters in prepared statements. > > My question is, what do people normally do when there's a variable > number of parameters? - for example: > >  se

Re: [GENERAL] Building PG 8.4.1 with ossp-uuid on Centos 5.3

2009-10-10 Thread Tom Lane
Christophe Pettus writes: > I'm attempting to build a version of PG 8.4.1 with the OSSP uuid > libraries on Centos 5.3 (I'm building PG from source). I simply > cannot seem to find the right libraries to install; even very > promising candidates seem to be a different version than the one P

[GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Kynn Jones
I am porting some code from Perl to Python; in the Perl original I use either DBI::do or a rickety home-built module to pass multiple SQL statements (as one single block of SQL) to the Pg server. The typical usage is something like this: $dbh->do( <

Re: [GENERAL] Integer range?

2009-10-10 Thread Scott Ribe
> Neither, really. The cast shortcut you're using is binding to the > digits more tightly than the minus prefix. I see, thanks. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To m

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Adrian Klaver
On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote: > I am porting some code from Perl to Python; in the Perl original I use > either DBI::do or a rickety home-built module to pass multiple SQL > statements (as one single block of SQL) to the Pg server. The typical > usage is something like

Re: [GENERAL] Building PG 8.4.1 with ossp-uuid on Centos 5.3

2009-10-10 Thread Christophe Pettus
On Oct 10, 2009, at 11:53 AM, Tom Lane wrote: Whose uuid package are you using? http://www.ossp.org/pkg/lib/uuid/ Building from source. If it's something you built from source, it more than likely installed into /usr/local/, and then your problem is that PG isn't searching /

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Adrian Klaver
On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote: > On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote: > > I am porting some code from Perl to Python; in the Perl original I use > > either DBI::do or a rickety home-built module to pass multiple SQL > > statements (as one single bl

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Kynn Jones
On Sat, Oct 10, 2009 at 4:14 PM, Adrian Klaver wrote: > On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote: > > On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote: > > > I am porting some code from Perl to Python; in the Perl original I use > > > either DBI::do or a rickety home-bu

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Rich Shepard
On Sat, 10 Oct 2009, Adrian Klaver wrote: One way Using psycopg2 DSN = "dbname=? user=? port=? host=?" con = psycopg2.connection(DSN) cur = con.cursor() cur.execute(statement1) cur.execute(statement2) con.commit() Another way, not tested, is triple quote entire block above and pass it to c

[GENERAL] Cannot upgrade to 8.4.1 on Windows

2009-10-10 Thread Bill Todd
I am a PostgreSQL novice. I successfully installed 8.3.3 on a Windows XP Pro machine using the pgInstaller and have been using it since. Now I want to upgrade to 8.4.1. The only installer I can find for Windows for 8.4.1 is the One Click installer provided by EnterpriseDB. If I attempt to run

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Adrian Klaver
On Saturday 10 October 2009 1:24:05 pm Kynn Jones wrote: > On Sat, Oct 10, 2009 at 4:14 PM, Adrian Klaver wrote: > > On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote: > > > On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote: > > > > I am porting some code from Perl to Python; in t

Re: [GENERAL] Prepared statements with a variable number of parameters

2009-10-10 Thread Raymond O'Donnell
On 10/10/2009 18:52, Pavel Stehule wrote: > 2009/10/10 Raymond O'Donnell : >> My question is, what do people normally do when there's a variable >> number of parameters? - for example: >> >> select . where item_id in ( ... ); >> > > You can use arrays here. > > select ... where item_id = A

[GENERAL] What's wrong with this regexp?

2009-10-10 Thread Nick
SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$' Im guessing its an escape issue, but where am I going wrong? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] What's wrong with this regexp?

2009-10-10 Thread Tim Landscheidt
Nick wrote: > SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$' > Im guessing its an escape issue, but where am I going wrong? You need to double-escape the question mark: Once for the string literal, once for the regular expression (and you do not need to escape the slashes). This g

Re: [GENERAL] What's wrong with this regexp?

2009-10-10 Thread Randal L. Schwartz
> "Nick" == Nick writes: Nick> SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$' Here's the first clue: merlyn=# select '^\/steps\/\?step=10$'; WARNING: nonstandard use of escape in a string literal LINE 1: select '^\/steps\/\?step=10$'; ^ HIN

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Massa, Harald Armin
Adrian, While I was walking the dog I thought of a better solution. > > sql_str = """ALTER TABLE %(xn)s OWNER TO xdev; > GRANT ALL ON TABLE %(xn)s TO xdev; > REVOKE ALL ON TABLE %(xn)s FROM PUBLIC; > GRANT SELECT ON TABLE %(xn)s TO PUBLIC;""" > > cur.execute(sql_str,{'xn':table_name}) > -- > Thi

Re: [GENERAL] How to send multiple SQL commands from Python?

2009-10-10 Thread Adrian Klaver
On Saturday 10 October 2009 5:48:39 pm Massa, Harald Armin wrote: > Adrian, > > While I was walking the dog I thought of a better solution. > > > sql_str = """ALTER TABLE %(xn)s OWNER TO xdev; > > GRANT ALL ON TABLE %(xn)s TO xdev; > > REVOKE ALL ON TABLE %(xn)s FROM PUBLIC; > > GRANT SELECT ON T

Re: [GENERAL] interface for "non-SQL people"

2009-10-10 Thread justin
pere roca wrote: hi, some nice tool over there to let non-SQL knowing people to construct their queries? I'm using pgAdmin III but I know some SQL. there is no other option than constructing an HTML with forms, drop-down menus...? thanks, pERE Your best bet which is not free is

Re: [GENERAL] interface for "non-SQL people"

2009-10-10 Thread Martin Gainty
oracle handles html output with packages ..i would assume pg would have similar sgml output capability? crystal has been limited to ODBC dsn (datasources) althogh sap seem to be open to a more Opensource approach using JDBC based data sources Martin Gainty

Re: [GENERAL] Building PG 8.4.1 with ossp-uuid on Centos 5.3

2009-10-10 Thread Tom Lane
Christophe Pettus writes: > On Oct 10, 2009, at 11:53 AM, Tom Lane wrote: >> Whose uuid package are you using? > http://www.ossp.org/pkg/lib/uuid/ > Building from source. > It is indeed installing it in /usr/local/lib, but the ldconfig was > set. What's irritating is that (looking at con

Re: [GENERAL] interface for "non-SQL people"

2009-10-10 Thread Lew
Martin Gainty wrote: Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.

[GENERAL] What is statement ID of table?

2009-10-10 Thread Jignesh Shah
Hi, Could any one please tell me what is statement ID of table? How to get it and in which scenarios it can be helpful? Any documentation or example about statement ID would also really helpful for me. Thanks, Jignesh