Re: [GENERAL] Using complex PRIMARY KEY

2009-10-08 Thread Gurjeet Singh
2009/10/8 Zsolt zshor...@freemail.hu This is our first project using PostgerSQL, where I have a problem I cant solve on a neat way (I assume PGSQL should provide a nice solution...). So we have an old xBase based program we are trying to port to PostgreSQL while we should keep the original

Re: [GENERAL] Using complex PRIMARY KEY

2009-10-08 Thread A. Kretschmer
In response to A. Kretschmer : In response to Zsolt : This is our first project using PostgerSQL, where I have a problem I cant solve on a neat way (I assume PGSQL should provide a nice solution...). So we have an old xBase based program we are trying to port to PostgreSQL while

[GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
Hi, in my database I store RTF files inside a Bytea field. Now a customer is requesting a search inside RTF fields and I'm trying to implement it by issuing this query: select * from my_table where cast(rtf_field as varchar) like '%condition%' This works ok when the condition doesn't

Re: [GENERAL] interface for non-SQL people

2009-10-08 Thread ssmagin
Hi, There is a http://www.activedbsoft.com/overview-querytool.html FlySpeed SQL Query tool, it's free if you don't need data export and printing. It's query builder is very good, but the author honestly says that basic knowledge of SQL concepts is required to to build a query... pere roca

[GENERAL] How to reduce WAL file Size

2009-10-08 Thread Mitesh51
By setting postgres.conf params...log files are generated of 16 MB each. How can I reduce the size of this files? can I force the log files to switch with any command as we do in mysql like flush log? where we force the new log creation ? -- View this message in context:

[GENERAL] Need info on PQfmod()

2009-10-08 Thread shrikant hanagodimath
Hi, I need to execute the INSERT statement on the table having NUMERIC column.Also,for some reason,I need to get the precision and scale of the NUMERIC Column. Could you please let me know how can I use the PQfmod function without getting the result set. Thanks Shrikant

[GENERAL] cost of query done - recorded anywhere?

2009-10-08 Thread Massa, Harald Armin
I know that is possible via EXPLAIN and EXPLAIN ANALYZE to get planned and actual time for one query - but no results. I am looking for information like: to do this query, I had to: - read x units from disk/os.cache - get n units from my own buffers - do n1 comparisons of strings - do n2

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Merlin Moncure
2009/10/8 Leonardo M. l.r...@griensu.com: Hi, in my database I store RTF files inside a Bytea field. Now a customer is requesting a search inside RTF fields and I'm trying to implement it by issuing this query: select  * from my_table where  cast(rtf_field as varchar) like '%condition%'

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 11:28 -0400, Merlin Moncure wrote: 2009/10/8 Leonardo M. l.r...@griensu.com: Hi, in my database I store RTF files inside a Bytea field. Now a customer is requesting a search inside RTF fields and I'm trying to implement it by issuing this query: select * from

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Sam Mason
On Thu, Oct 08, 2009 at 10:58:05AM -0300, Leonardo M. Rammm wrote: cast(rtf_field as varchar) like '%condition%' I don't think that cast isn't doing what you expect at all. As an example, try doing something like: select cast(bytea e'hi\nbye' as varchar); encode() may be what you want

[GENERAL] Give me a HINT or I'll got crazy ;)

2009-10-08 Thread wstrzalka
So the query is: SELECT m.messageid, mad.destination FROM messages AS m LEFT JOIN message_address_link AS mal ON (mal.message_id = m.messageid) JOIN message_address_data AS mad ON (mad.id = mal.address_id) WHERE delete_status 1 AND

[GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Daniel Shane
Hi all! I have an interesting problem here that I think could be of interest to everyone. I in the process of writing test cases for our applications and there is one problem I am facing. To be able to test correctly, I need to create a small database (a sample if you want) from a very large

Re: [GENERAL] How to reduce WAL file Size

2009-10-08 Thread Emanuel Calvo Franco
By setting postgres.conf params...log files are generated of 16 MB each. How can I reduce the size of this files? can I force the log files to switch with any command as we do in mysql like flush log? where we force the new log creation ? pg_switch_xlog() is the switch function. The option

Re: [GENERAL] Give me a HINT or I'll got crazy ;)

2009-10-08 Thread Tom Lane
wstrzalka wstrza...@gmail.com writes: Prior to the playing with statistics target (it was 100 by default) I was able to go with the time to 30ms by adding to the query such a condition: So what sort of playing did you do? It looks to me like the core of the problem is the sucky join size

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi all! I have an interesting problem here that I think could be of interest to everyone. I in the process of writing test cases for our applications and there is one problem I am facing. To be able to test correctly, I need to create a small database (a sample if you want)

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Daniel Shane
Hi Scott! The problem is that my test database has several tables with many links between them, so I have no idea which 1000 rows to get from which table. The only thing I can do is run the program that connects to that database and tell it to run on a sample of the database. I can get a log

[GENERAL] Remote connection timed out

2009-10-08 Thread Barbara Stephenson
Hello, We have a website that connects remotely to our 8.3 postgres database. I've noticed if I connect to the database and let it sit for an hour the connection is lost. Is there a default connection timeout? -- Regards, Barbara Stephenson /EDI Specialist/Programmer/ *Turbo, division

[GENERAL] Renaming constraints

2009-10-08 Thread Andreas Kalsch
How do I rename constraints? Renaming columns will not rename constraints. Andi -- 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] Renaming constraints

2009-10-08 Thread David Fetter
On Thu, Oct 08, 2009 at 08:24:06PM +0200, Andreas Kalsch wrote: How do I rename constraints? Renaming columns will not rename constraints. BEGIN; ALTER TABLE foo DROP CONSTRAINT bar; ALTER TABLE foo ADD CONSTRAINT bluf...; COMMIT; Cheers, David. -- David Fetter da...@fetter.org

[GENERAL] Broken WAL recovery, resetting to base timeline

2009-10-08 Thread David Jantzen
Hi All, While recovering a database, we encountered a file permissions problem on new WAL segments that caused recovery with pg_standby to exit prematurely. Now the database is in a new timeline. What we need to do (I think) is reset the database timeline to that of the base copy and resume

Re: [GENERAL] Remote connection timed out

2009-10-08 Thread Steve Crawford
Barbara Stephenson wrote: Hello, We have a website that connects remotely to our 8.3 postgres database. I've noticed if I connect to the database and let it sit for an hour the connection is lost. Is there a default connection timeout? How remote? Through firewalls/VPNs/etc.? My

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Andreas Kalsch
But with this operation you will recreate the whole index. - I have found out, that the name of the constraint's index is the same as the constraint, so that I can simply rename the index. My problem is that I want to hook up a new version of existing tables into my production system. 1)

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Emanuel Calvo Franco
select  * from my_table where  cast(rtf_field as varchar) like '%condition%' This works ok when the condition doesn't include accented chars. RTF escapes accented characters as \'f1 for í, \'f3 for ó, and so on. To escape \ and ', I'd read it shuld be used \\ and '', so I thaugth that a

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Tom Lane
Andreas Kalsch andreaskal...@gmx.de writes: But with this operation you will recreate the whole index. - I have found out, that the name of the constraint's index is the same as the constraint, so that I can simply rename the index. You'd probably better rename the constraint too to avoid

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Thom Brown
2009/10/8 Tom Lane t...@sss.pgh.pa.us You'd probably better rename the constraint too to avoid confusion. Failing anything else, there's always direct UPDATE of the pg_constraint catalog. If it's only a matter of the entry in the pg_constraint catalog being changed, couldn't a more intuitive

Re: [GENERAL] interface for non-SQL people

2009-10-08 Thread Merlin Moncure
On Tue, Oct 6, 2009 at 3:47 PM, pere roca pero...@gmail.com 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...? Cant

[GENERAL] Using pg_catalog to define things across schemas

2009-10-08 Thread Andreas Kalsch
I am currently trying to solve the problem by using different schemas, but then I have to consider all the GIS stuff. Putting the same things in different schemas is no problem, but comparing the same type defined in different schemas will lead to confusion, because Postgres treats them as

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 17:01 -0300, Emanuel Calvo Franco wrote: select * from my_table where cast(rtf_field as varchar) like '%condition%' This works ok when the condition doesn't include accented chars. RTF escapes accented characters as \'f1 for í, \'f3 for ó, and so on. To

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Emanuel Calvo Franco
2009/10/8 Leonardo M. l.r...@griensu.com: On jue, 2009-10-08 at 17:01 -0300, Emanuel Calvo Franco wrote: select  * from my_table where  cast(rtf_field as varchar) like '%condition%' This works ok when the condition doesn't include accented chars. RTF escapes accented characters as

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 17:51 -0300, Emanuel Calvo Franco wrote: part=# select * from p where i::text ~~ $$%''f3%$$; i -- ''f3 (1 row) I don't have any problem, wich enconding you are using? (select getdatabaseencoding(); ) Thanks, now this works: set

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Alvaro Herrera
Leonardo M. Ramé escribió: select idturno, infres::text from turno where infres::text ~~ $$%diagn'f3stico%$$; Just make sure you don't have $$ in the search pattern ... -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication,

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

2009-10-08 Thread Mike Christensen
(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? I'm guessing numeric(2,3) should be fine, yes? I'm not too familiar with the numeric type (I was using real before), but as I understand the data will be

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

2009-10-08 Thread Steve Crawford
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? I'm guessing numeric(2,3) should be fine, yes? I'm not too familiar with the numeric type (I was using real before), but as I

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

2009-10-08 Thread Christophe Pettus
On Oct 8, 2009, at 3:04 PM, Mike Christensen wrote: I'm guessing numeric(2,3) should be fine, yes? Numeric is definitely what you want. You probably want at least four fractional digits, since sales tax (at least in California) is routinely set to a quarter of a point. For example, the

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

2009-10-08 Thread Merlin Moncure
On Thu, Oct 8, 2009 at 6:04 PM, Mike Christensen m...@kitchenpc.com 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?  I'm guessing numeric(2,3) should be fine, yes?  I'm not too familiar with the

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

2009-10-08 Thread Mike Christensen
Oops sorry I was thinking 2,3 meant 2 significant digits to the left of the decimal point and 3 to the right. I just re-read the docs and now see what you mean. 6,3 would work fine though is maybe a bit overkill since a 100% sales tax rate would cause a violent revolution and lead to beheadings,

Re: [GENERAL] How to reduce WAL file Size

2009-10-08 Thread Alban Hertroys
On 8 Oct 2009, at 9:35, Mitesh51 wrote: By setting postgres.conf params...log files are generated of 16 MB each. How can I reduce the size of this files? can I force the log files to switch with any command as we do in mysql like flush log? where we force the new log creation ? Why do

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

2009-10-08 Thread Rich Shepard
On Thu, 8 Oct 2009, Mike Christensen wrote: I'll probably just use 3,3 and store this value between 0 and 1, since all I'll be doing with this number is using it to multiply against a subtotal. 3,3 gives me 0.000 through 0.999, correct? Mike, No. The two digits represent the width of the

Re: [GENERAL] interface for non-SQL people

2009-10-08 Thread Scott Marlowe
On Thu, Oct 8, 2009 at 2:22 PM, Merlin Moncure mmonc...@gmail.com wrote: The #1 tool you have at your disposal is the human brain.  I personally think GUI database tools are counter productive and huge time wasters.  SQL requires lateral thinking but once you have your head around how joins

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

2009-10-08 Thread Lew
Rich Shepard wrote: On Thu, 8 Oct 2009, Mike Christensen wrote: I'll probably just use 3,3 and store this value between 0 and 1, since all I'll be doing with this number is using it to multiply against a subtotal. 3,3 gives me 0.000 through 0.999, correct? Mike, No. The two digits

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi Scott! The problem is that my test database has several tables with many links between them, so I have no idea which 1000 rows to get from which table. The only thing I can do is run the program that connects to that database and tell it to run on a sample of the