[GENERAL] Short CVS question, history

2008-11-07 Thread Dirk Riehle
Hi, I have a short CVS question please: How do I go from a particular file revision like pgsql/cvs/pgsql/src/backend/parser/parse_relation.c.1.3 to the complete commit? I.e. I would like to navigate back from this particular file to the commit and see all the other files that were touched by th

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Brent Wood
Thanks Adrian, That's perfect!! Cheers, Brent Brent Wood DBA/GIS consultant NIWA, Wellington New Zealand >>> Adrian Klaver <[EMAIL PROTECTED]> 11/08/08 1:49 PM >>> On Friday 07 November 2008 4:05:08 pm Brent Wood wrote: > Thanks guys, > > I'm aware of those options, what I was wondering was

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Tom Lane
Jason Long <[EMAIL PROTECTED]> writes: > I got this error > /usr/sbin/sendmail: Permission denied > So I guess I need to allow the use of sendmail. > How is postgres running the command different from my doing it as the > postgres user or cron running as the postgres user? SELinux treats it diff

Re: [GENERAL] options for launching sql script asynchronously from web app

2008-11-07 Thread Nikolas Everett
Authenticate in web app and drop a script in a directory and run them with cron maybe? Authenticate in web app and drop a row in a table and let a long running process suck the row out and kick something off in a thread pool? I've seen both. You've got to monitor both somehow. The second one is

[GENERAL] options for launching sql script asynchronously from web app

2008-11-07 Thread Ivan Sergio Borgonovo
I'd like to launch some sql script asynchronously from a web app and have some kind of feedback later. Some form of authentication would be a plus. Is there anything ready? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] postgresql and Mac OS X

2008-11-07 Thread Tom Allison
adam_pgsql wrote: When I do the install script in contrib it says I have no rights to the directory. It was in /usr/local/pgsql/data/log and I changed it to /usr/local/pgsql/log. It was set as root.wheel with 755 permissions so I suspect it's mad at me because the postgres user was left in t

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Jason Long
Tom Lane wrote: Jason Long <[EMAIL PROTECTED]> writes: Tom Lane wrote: If that is what's happening, you'll find "avc denied" messages in the system log that correlate to the archive failures. *I did not see anything like this in my logs.* You'd need to look in the system

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Adrian Klaver
On Friday 07 November 2008 4:05:08 pm Brent Wood wrote: > Thanks guys, > > I'm aware of those options, what I was wondering was if there is a more > generic way, for example the Empress RDBMS allows 'set MSNULLVALUE "NA"', > and all NULLs will from then on be output as NA. > > The COPY option is cl

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Ivan Sergio Borgonovo
On Sat, 08 Nov 2008 13:05:08 +1300 "Brent Wood" <[EMAIL PROTECTED]> wrote: > Thanks guys, > > I'm aware of those options, what I was wondering was if there is a > more generic way, for example the Empress RDBMS allows 'set > MSNULLVALUE "NA"', and all NULLs will from then on be output as NA. > >

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Brent Wood
Thanks guys, I'm aware of those options, what I was wondering was if there is a more generic way, for example the Empress RDBMS allows 'set MSNULLVALUE "NA"', and all NULLs will from then on be output as NA. The COPY option is closest to a generic setting, but doesn't work with a select query

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Jason Long
Tom Lane wrote: Jason Long <[EMAIL PROTECTED]> writes: Tom Lane wrote: If that is what's happening, you'll find "avc denied" messages in the system log that correlate to the archive failures. *I did not see anything like this in my logs.* You'd need to look in the system

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Tom Lane
Jason Long <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> If that is what's happening, you'll find "avc denied" messages in the >> system log that correlate to the archive failures. >> > *I did not see anything like this in my logs.* You'd need to look in the system log (/var/log/messages) not

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Jason Long
Tom Lane wrote: I wrote: That's just bizarre. The permissions on the script itself seem to be fine, so the only theory that comes to mind is the server doesn't have search (x) permission on one of the containing directory levels ... Oh, wait, I bet I've got it: you're using a SELinux-

Re: [GENERAL] Show all commands executed

2008-11-07 Thread Tom Lane
"Anderson dos Santos Donda" <[EMAIL PROTECTED]> writes: > How can I show on terminal all commands executed by my postgre server? You could turn on log_statements and then tail -f the postmaster log. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@

[GENERAL] Show all commands executed

2008-11-07 Thread Anderson dos Santos Donda
How can I show on terminal all commands executed by my postgre server? Example: My system execute the comand : 'SELECT * FROM clients' and the postgre show this commando on the terminal ? Thanks

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Tom Lane
I wrote: > That's just bizarre. The permissions on the script itself seem to be > fine, so the only theory that comes to mind is the server doesn't have > search (x) permission on one of the containing directory levels ... Oh, wait, I bet I've got it: you're using a SELinux-enabled system and SEL

Re: [GENERAL] archive command Permission Denied?

2008-11-07 Thread Tom Lane
Jason Long <[EMAIL PROTECTED]> writes: > I am working on archiving my WAL files. For now I am just mailing > myself a list of the directory contents using the following script. > *-rwxr-xr-x 1 postgres postgres 87 Oct 28 20:23 > /var/lib/pgsql/mail-WAL-list.sh* > I can run this when logged on

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Mike Toews
Mike Toews wrote: Keep in mind that you can't mix data types, like 'NaN'::text and 32.3::float in the result. oh yeah, regarding mixing data types (in regards to the first post)... A good exception is that you can use 'NaN' for floating point data types, so: SELECT COALESCE(myval, 'NaN')

[GENERAL] archive command Permission Denied?

2008-11-07 Thread Jason Long
Please bear with me. I am fairly new to Linux. I am working on archiving my WAL files. For now I am just mailing myself a list of the directory contents using the following script. *-rwxr-xr-x 1 postgres postgres 87 Oct 28 20:23 /var/lib/pgsql/mail-WAL-list.sh* the contents are simply *l

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Mike Toews
Said Ramirez wrote: I think you are more after something like SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar. -Said An even simpler way to do this is using the COALESCE function: http://www.postgresql.org/docs/current/interactive/functions-conditional.html SELECT COALESCE(foo, 'NA') AS

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Ivan Sergio Borgonovo
On Fri, 07 Nov 2008 15:20:24 -0500 Said Ramirez <[EMAIL PROTECTED]> wrote: > I think you are more after something like > > SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar. missing an else at least and... wtw_drupal=# create table test.test(c1 int); CREATE TABLE wtw_drupal=# insert into test

Re: [GENERAL] INSERT .... RETURNING

2008-11-07 Thread Dennis Brakhane
On Thu, Nov 6, 2008 at 8:49 AM, Rafal Pietrak <[EMAIL PROTECTED]> wrote: > One comment I'd like to make as total lamer on the subject, is that the > assumption on SELECT (that it's not firing triggers), could potentially > be resolved by a *global* or "database" configuration option - once > select

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Said Ramirez
I think you are more after something like SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar. -Said Ivan Sergio Borgonovo wrote: On Thu, 6 Nov 2008 17:44:42 -0800 (PST) [EMAIL PROTECTED] wrote: > > Hi, > > I can specify the text used to represent a null value in output > from copy, but

Re: [GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread Ivan Sergio Borgonovo
On Thu, 6 Nov 2008 17:44:42 -0800 (PST) [EMAIL PROTECTED] wrote: > > Hi, > > I can specify the text used to represent a null value in output > from copy, but I'd like to do something similar is select output, > eg: all NULL values are represented by NA or NaN. > > I can't find anything in the d

[GENERAL] Defining string to represent null values in select

2008-11-07 Thread Brent Wood
Hi, I can specify the text used to represent a null value in output from copy, but I'd like to do something similar is select output, eg: all NULL values are represented by NA or NaN. I can't find anything in the docs about this. This could be managed using case statements around all the colu

[GENERAL] Specifying text to substitute for NULLs in selects

2008-11-07 Thread pcreso
Hi, I can specify the text used to represent a null value in output from copy, but I'd like to do something similar is select output, eg: all NULL values are represented by NA or NaN. I can't find anything in the docs about this. This could be managed using case statements around all the colu

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Gerhard Heift
On Fri, Nov 07, 2008 at 11:15:07AM +0100, Thomas Kellerer wrote: > Hi, > > are there any plans to support updating a tuple using a sub-select in one of > the future versions. > > e.g, something like: > > UPDATE report_table > SET (order_count,order_value) = (SELECT count(*), sum(amount) >

Re: [GENERAL] After delete trigger problem

2008-11-07 Thread Erik Jones
On Nov 7, 2008, at 11:24 AM, Erik Jones wrote: On Nov 7, 2008, at 10:57 AM, Teemu Juntunen wrote: Hello, I have a child table with CONSTRAINT fkey FOREIGN KEY (x) REFERENCES master (x) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE. and CREATE TRIGGER td_y AFTER DELETE ON chlid F

Re: [GENERAL] After delete trigger problem

2008-11-07 Thread Erik Jones
On Nov 7, 2008, at 10:57 AM, Teemu Juntunen wrote: Hello, I have a child table with CONSTRAINT fkey FOREIGN KEY (x) REFERENCES master (x) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE. and CREATE TRIGGER td_y AFTER DELETE ON chlid FOR EACH ROW EXECUTE PROCEDURE fn_td_y(); and th

Re: [GENERAL] After delete trigger problem

2008-11-07 Thread Tom Lane
"Teemu Juntunen" <[EMAIL PROTECTED]> writes: > CREATE TRIGGER td_y AFTER DELETE ON chlid FOR EACH ROW EXECUTE PROCEDURE > fn_td_y(); > It seems that SELECT results to null, so the master has already deleted the > row. Is this intended and how can I solve this? Your trigger is firing after the

[GENERAL] After delete trigger problem

2008-11-07 Thread Teemu Juntunen
Hello, I have a child table with CONSTRAINT fkey FOREIGN KEY (x) REFERENCES master (x) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE. and CREATE TRIGGER td_y AFTER DELETE ON chlid FOR EACH ROW EXECUTE PROCEDURE fn_td_y(); and this trigger refers to the master table... CREATE OR REPLAC

Re: [GENERAL] Importing text file into a TEXT field

2008-11-07 Thread Bruno Lavoie
Hello, The intent is to use pdftotext and store the resulting text in datbase for full text search purposes... I'm trying to develop a mini content server where I'll put pdf documents to make it searchable. Generally, PDFs are in size of 500 to 3000 pages resulting in text from 500kb to 2meg

Re: [GENERAL] sum timestamp result in hours

2008-11-07 Thread Sam Mason
On Fri, Nov 07, 2008 at 06:10:15AM -0800, paulo matadr wrote: > select sum(age(rgat.rgat_tmencerramento, rgat.rgat_tmregistroatendimento)) > from atendimentopublico.registro_atendimento rgat [... lots of complicated and irrelevant SQL] > Result: 1 year 4 mons 88 days 51:42:00 > > I need help to

Re: [GENERAL] How to design a "customer" TABLE which hold credit card infos and other payments?

2008-11-07 Thread Scott Marlowe
Oh, btw, the wikipedia page on the PCI standard I mentioned http://en.wikipedia.org/wiki/PCI_DSS -- 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] Redefining an existing Table Schema for Foreign Key Constraint - Question

2008-11-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Michelle Konzack <[EMAIL PROTECTED]> writes: > Hallo Harald, > Am 2008-11-03 13:41:52, schrieb Harald Fuchs: >> In article <[EMAIL PROTECTED]>, >> Brian714 <[EMAIL PROTECTED]> writes: >> > Customers Table >> > id:integer -- primary key >> > first_name:varchar(50) >>

Re: [GENERAL] Importing text file into a TEXT field

2008-11-07 Thread Sam Mason
On Fri, Nov 07, 2008 at 11:15:43AM -0500, Bruno Lavoie wrote: > Is there a way to easily import a relatively huge text file into a table > column? How big is "relatively huge"? > I'd like to use psql and I`'ve looked at lo_* commands and I > can't figure how to import my text file into my TEXT

[GENERAL] Importing text file into a TEXT field

2008-11-07 Thread Bruno Lavoie
Hello, Is there a way to easily import a relatively huge text file into a table column? I'd like to use psql and I`'ve looked at lo_* commands and I can't figure how to import my text file into my TEXT column. My last solution is to write a little script to load my text file in a var and then

Re: [GENERAL] How to design a "customer" TABLE which hold credit card infos and other payments?

2008-11-07 Thread Andrei Kovalevski
Hello, Scott Marlowe wrote: On Thu, Nov 6, 2008 at 2:43 PM, Michelle Konzack <[EMAIL PROTECTED]> wrote: * Do not Cc: me, because I READ THIS LIST, if I write here * *Keine Cc: am mich, ich LESE DIESE LIS

Re: [GENERAL] Database access over the Internet...

2008-11-07 Thread Scott Marlowe
On Thu, Nov 6, 2008 at 2:27 PM, Michelle Konzack <[EMAIL PROTECTED]> wrote: > > * Do not Cc: me, because I READ THIS LIST, if I write here * > *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe

Re: [GENERAL] How to design a "customer" TABLE which hold credit card infos and other payments?

2008-11-07 Thread Scott Marlowe
On Thu, Nov 6, 2008 at 2:43 PM, Michelle Konzack <[EMAIL PROTECTED]> wrote: > > * Do not Cc: me, because I READ THIS LIST, if I write here * > *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Thomas Kellerer
Tom Lane, 07.11.2008 14:33: Thomas Kellerer <[EMAIL PROTECTED]> writes: are there any plans to support updating a tuple using a sub-select in one of the future versions. It's the first item under UPDATE on the TODO list ... That is good news :) Thanks Thomas -- Sent via pgsql-general ma

Re: [GENERAL] How to use index in WHERE int = float

2008-11-07 Thread Sam Mason
On Thu, Nov 06, 2008 at 12:08:57AM +0200, Andrus wrote: > >PG 8.3 would > >even throw it out, unless dokumnr was explicitly cast to a float8 as > >well. > > I tried in 8.3 > > create temp table dok ( dokumnr serial primary key ); > select * from dok where dokumnr='1'::float8 > > and this run wit

[GENERAL] sum timestamp result in hours

2008-11-07 Thread paulo matadr
select sum(age(rgat.rgat_tmencerramento, rgat.rgat_tmregistroatendimento)) from atendimentopublico.registro_atendimento rgat inner join cadastro.localidade loca on loca.loca_id=rgat.loca_id inner join atendimentopublico.solicitacao_tipo_especificacao step on step.step_id=rgat.step_id where date(rg

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Thomas Kellerer
Gerhard Heift, 07.11.2008 14:47: What about: UPDATE report_table SET order_count = s_count, order_value = s_value FROM (SELECT count(*) AS s_count, sum(amount) AS s_value FROM order o WHERE o.customer_id = report_table.customer_id) Its untested, but I think, it must works like this. Inter

Re: [GENERAL] avoiding seq scan without duplicating

2008-11-07 Thread Andrus
Tom, The proposed transformation is not correct because of the odd behavior of NOT IN with respect to nulls. Thank you. In this particular case dokumnr is dok table primary key of type int. bilkaib.dokumnr can contain nulls but this does not affect to result probably. So in this case this

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Gerhard Heift
On Fri, Nov 07, 2008 at 02:31:42PM +0100, Thomas Kellerer wrote: > Gerhard Heift, 07.11.2008 13:35: >>> are there any plans to support updating a tuple using a sub-select in one >>> of the future versions. >>> >>> e.g, something like: >>> >>> UPDATE report_table >>> SET (order_count,order_value)

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Tom Lane
Thomas Kellerer <[EMAIL PROTECTED]> writes: > are there any plans to support updating a tuple using a sub-select in one of > the future versions. It's the first item under UPDATE on the TODO list ... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-genera

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Thomas Kellerer
Gerhard Heift, 07.11.2008 13:35: are there any plans to support updating a tuple using a sub-select in one of the future versions. e.g, something like: UPDATE report_table SET (order_count,order_value) = (SELECT count(*), sum(amount) FROM order o

Re: [GENERAL] avoiding seq scan without duplicating

2008-11-07 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > Simple query is slow, performs seq scan while index exists: > explain select count(*)::integer as cnt > from firma2.dok > where dokumnr in (17,2) and > dokumnr not in (select dokumnr FROM firma2.bilkaib WHERE > alusdok='LF' -- and dokumnr in (17,2) >

[GENERAL] avoiding seq scan without duplicating

2008-11-07 Thread Andrus
Simple query is slow, performs seq scan while index exists: explain select count(*)::integer as cnt from firma2.dok where dokumnr in (17,2) and dokumnr not in (select dokumnr FROM firma2.bilkaib WHERE alusdok='LF' -- and dokumnr in (17,2) ) "Aggregate (cost=152063.71..152063.73 rows=1

Re: [GENERAL] Equivalent for AUTOINCREMENT?

2008-11-07 Thread Craig Ringer
Michelle Konzack wrote: > Halle Craig, > > Am 2008-11-05 20:37:31, schrieb Craig Ringer: >> If you really, truly need gapless sequences, there are some options. I >> posted about them recently on another thread. The archives will contain >> that post and many others from many people on the same

Re: [GENERAL] Equivalent for AUTOINCREMENT?

2008-11-07 Thread Craig Ringer
Michelle Konzack wrote: > The ONLY real option would be, go to a HostingProvider which VERY good > and reliabel Internet connectivity and install there my WHOLE PostgreSQL > database and let my other websites access them over the internet... ... making them subject to problems with transit betw

Re: [GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Gerhard Heift
On Fri, Nov 07, 2008 at 11:15:07AM +0100, Thomas Kellerer wrote: > Hi, > > are there any plans to support updating a tuple using a sub-select in one of > the future versions. > > e.g, something like: > > UPDATE report_table > SET (order_count,order_value) = (SELECT count(*), sum(amount) >

Re: [GENERAL] Equivalent for AUTOINCREMENT?

2008-11-07 Thread Michelle Konzack
Hi again, Am 2008-11-05 20:13:40, schrieb Craig Ringer: > Michelle Konzack wrote: > >OK, you hit me, I am trying to convert a mysql scheme to postgresql... OK, in the same time I am trying to make programs like os-commerce PostgreSQL usable > >Realy, I hate programs which relay on ONE dat

[GENERAL] Database access over the Internet...

2008-11-07 Thread Michelle Konzack
* Do not Cc: me, because I READ THIS LIST, if I write here * *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe* ...bec

Re: [GENERAL] Semi-customized queries? Subset of SQL? Accessing the parser? Injection?

2008-11-07 Thread Michelle Konzack
Am 2008-11-04 11:12:05, schrieb Webb Sprague: > > If they're that smart, they're smart enough to deal with SQL, and > > likely to be frustrated by a like-sql-but-not command language or > > a GUI query designer. > > > > Instead, create a user that only has enough access to read data (and > > maybe

[GENERAL] How to design a "customer" TABLE which hold credit card infos and other payments?

2008-11-07 Thread Michelle Konzack
* Do not Cc: me, because I READ THIS LIST, if I write here * *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe* Hello,

Re: [GENERAL] Redefining an existing Table Schema for Foreign Key Constraint - Question

2008-11-07 Thread Michelle Konzack
Hallo Harald, Am 2008-11-03 13:41:52, schrieb Harald Fuchs: > In article <[EMAIL PROTECTED]>, > Brian714 <[EMAIL PROTECTED]> writes: > > Customers Table > > id:integer -- primary key > > first_name:varchar(50) > > last_name:varchar(50) > > cc_id:integer references Creditcards.id > > address:varcha

Re: [GENERAL] Equivalent for AUTOINCREMENT?

2008-11-07 Thread Michelle Konzack
Halle Craig, Am 2008-11-05 20:37:31, schrieb Craig Ringer: > If you really, truly need gapless sequences, there are some options. I > posted about them recently on another thread. The archives will contain > that post and many others from many people on the same topic. Be aware, > though, that

[GENERAL] UPDATE tuples with a sub-select

2008-11-07 Thread Thomas Kellerer
Hi, are there any plans to support updating a tuple using a sub-select in one of the future versions. e.g, something like: UPDATE report_table SET (order_count,order_value) = (SELECT count(*), sum(amount) FROM order o WHE

[GENERAL] restruct cash table

2008-11-07 Thread Gerhard Heift
Hello, I have a small problem with my table: I have a table for my cash and i do several actions in it. I receive money in different forms, I expend money in different forms etc. And do each action I have various foreign keys. But they are not all in use in every column. I don't know how I can str