[GENERAL] "and then" / "or else"

2007-11-17 Thread Christian Schröder
Hi list, the logical operators "and" and "or" are commutative, i.e. there is no "short-circuiting". Especially when doing PL/pgSQL development it would sometimes be very handy to have this short circuiting. Unfortunately, the trick from the docs (chapter 4.2.12) using "case ... then" does not

Re: [GENERAL] "and then" / "or else"

2007-11-17 Thread Michael Glaesemann
On Nov 17, 2007, at 3:53 , Christian Schröder wrote: Unfortunately, the trick from the docs (chapter 4.2.12) using "case ... then" does not work inside an "if" statement (the "then" of the "case" is interpreted as belonging to the "if" and thus leads to a syntax error). I think if you us

Re: [GENERAL] Composite types for composite primary/foreign keys?

2007-11-17 Thread Michael Glaesemann
On Nov 16, 2007, at 4:07 , Wolfgang Keller wrote: But I am pathetically lazy >;->, so I ld like to save keystrokes and thus I had the (maybe pathetic)idea to use composite types for the composite primary (and foreign) keys. No luck again, it seems to me, as according to the documentation:

Re: [GENERAL] "and then" / "or else"

2007-11-17 Thread Christian Schröder
Michael Glaesemann wrote: On Nov 17, 2007, at 3:53 , Christian Schröder wrote: Unfortunately, the trick from the docs (chapter 4.2.12) using "case ... then" does not work inside an "if" statement (the "then" of the "case" is interpreted as belonging to the "if" and thus leads to a syntax erro

Re: [GENERAL] pg_dump not including custom CAST?

2007-11-17 Thread Michael Glaesemann
On Nov 17, 2007, at 0:36 , Tom Lane wrote: "D. Dante Lorenso" <[EMAIL PROTECTED]> writes: I did this in my database: CREATE CAST (VARCHAR AS BYTEA) WITHOUT FUNCTION; I'm using PostgreSQL 8.2.4 for both the dump and restore database. Why doesn't the CAST dump and restore? pg_dump thi

[GENERAL] max_fsm_relations

2007-11-17 Thread Oliver Kohll
Hi, My max_fsm_relations is set to 2000, up from the default of 1000 after previously getting warnings logged when the number of tables and indexes exceeded that. Looking again at it now, about a year later, our databases have grown. In one database, the number of indexes and tables is

Re: [GENERAL] Qeury a boolean column?(using postgresql & EJB)

2007-11-17 Thread dycharles
thank for the reply, i already do that method, but nothing happen... i have another solution to that one, i just used 1 and 0 for true and false.. it sounds bad, but thats the only thing i can do to maximized my time thanks... regards, dycharles Michael Glaesemann-2 wrote: > > > On N

Re: [GENERAL] Qeury a boolean column?(using postgresql & EJB)

2007-11-17 Thread Michael Glaesemann
[Please don't top post as it makes the discussion more difficult to follow.] On Nov 17, 2007, at 10:24 , dycharles wrote: i already do that method, but nothing happen... i have another solution to that one, i just used 1 and 0 for true and false.. it sounds bad, but thats the only thin

Re: [GENERAL] pg_dump not including custom CAST?

2007-11-17 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > On Nov 17, 2007, at 0:36 , Tom Lane wrote: >> pg_dump thinks it's a built-in system object. > What other objects might be susceptible to this? Operators? Operator > classes? It's just casts. They're a bit of a problem since they have neither own

Re: [GENERAL] Need help with complicated SQL statement

2007-11-17 Thread Shane Ambler
Ted Byers wrote: Please consider the following statement (it becomes obvious if you remember the important thing about the table is that it has columns for each of stock_id, price_date, and price). (SELECT * FROM stockprices WHERE stock_id = 1 ORDER BY price_date DESC LIMIT 1) UNION (SELECT * FR

[GENERAL] HINT: Please REINDEX it.

2007-11-17 Thread nabakumar salam
Hi, When i start the postgres DB , it starts properly. but when i am trying to connect to it . it shows a pop up with the error message "Error connecting to the server: FATAL: index "pg_class_oid_index" contains unexpected zero page at block 0 HINT: Please REINDEX it." i tried starting the da

Re: [GENERAL] Need help with complicated SQL statement

2007-11-17 Thread Ted Byers
--- Shane Ambler <[EMAIL PROTECTED]> wrote: > Ted Byers wrote: > > Please consider the following statement (it > becomes > > obvious if you remember the important thing about > the > > table is that it has columns for each of stock_id, > > price_date, and price). > > > > (SELECT * FROM stockpric

[GENERAL] regexp_replace() function in new version

2007-11-17 Thread Abhijeet
Hi, regexp_replace() function in new version of PostgreSQL is giving error. I am trying to remove tags from string. I have tried following regex in & function: - SELECT regexp_replace('Abhijeet', '<(\s)*/?(?i:script|i|b|u|embed|object|a|frameset|frame|iframe|meta|link|style|table|th|td|t

Re: [GENERAL] md5() sorting

2007-11-17 Thread Lew
Karsten Hilbert wrote: On Wed, Nov 07, 2007 at 05:36:47PM +0200, Marko Kreen wrote: I'm wondering if you cast the md5sum as a bytea instead of text and then sort, if that would solve it simply. Along the lines of ... ORDER BY decode(md5('...'), 'hex'); Maybe using digest(.., 'md5')

Re: [GENERAL] float to int

2007-11-17 Thread Lew
Edoardo Panfili wrote: Charles.Hou ha scritto: how can i get the int value using the sql language? like this, "select cost from my_money_table " , the data type of cost is float. take a look at http://www.postgresql.org/docs/8.2/static/sql-expressions.html CAST ( expression AS type ) expressi

Re: [GENERAL] Bulk Load Ignore/Skip Feature

2007-11-17 Thread Ow Mun Heng
On Wed, 2007-11-14 at 00:02 -0800, Willem Buitendyk wrote: > Perfect - that appears to be exactly what I was looking for. > Reg Me Please wrote: > > Il Wednesday 14 November 2007 05:50:36 Willem Buitendyk ha scritto: > > > >> Will Postgresql ever implement an ignore on error feature when bulk

Re: [GENERAL] update record with two-column primary key

2007-11-17 Thread Lew
Scott Marlowe wrote: Charles Mortell wrote: Using PG 8.0 on Windows, I have a table 'business_list' with a two column primary key. It's a linking table and it's primary keys are the keys from the two tables I am linking: item_id and business. Should I be able to update one of those primary key fi

Re: [GENERAL] pg_dump problem

2007-11-17 Thread SHARMILA JOTHIRAJAH
Hi The dump works now after deleting those rows from the pg_rewrite table Thanks for your help sharmila - Original Message From: Tom Lane <[EMAIL PROTECTED]> To: SHARMILA JOTHIRAJAH <[EMAIL PROTECTED]> Cc: pgsql-general@postgresql.org Sent: Wednesday, November 14, 2007 3:33:20 PM Subject:

Re: [GENERAL] Query Performance Test

2007-11-17 Thread Lew
dcrespo wrote: I have a query that I want to test twice to see its performance with and without another program running (anti-virus program). I know that if you run the same query for the second time, it will be faster than the first time. So, how can I do to execute it as if it was the first tim

[GENERAL] Compressed Backup too big

2007-11-17 Thread Andrus
"PostgreSQL 8.2.3 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" Database size in disk returned by pg_database_size() is 210 MB Database compressesed backup file size is now 125 MB. This seems too much. I expect compression to decrease size 10 times, also indexes are

[GENERAL] ERROR: invalid restriction selectivity: 224359728.000000

2007-11-17 Thread xeb
Hello! Process postmaster completly eat my proccessor for a long time and i see that message in logs. Does anybody know what does the subj means and why it occures ? ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [GENERAL] Linux v.s. Mac OS-X Performance

2007-11-17 Thread Mark Niedzielski
Thanks to all for the help - and the sanity check. The problem was in the test and not in the configuration. We were using a particularly difficult query as a reference (and fully understanding that it is a two-dimensional alternative to a proper benchmark). On our test system each run was with

[GENERAL] GIN: any ordering guarantees for the hits returned?

2007-11-17 Thread adrobj
Hello, I have a moderately large (~10-20GB) table: CREATE TABLE msgs ( msg varchar(2048), msg_tsv tsvector, posted timestamp ); CREATE INDEX msgs_i ON msgs USING gin(msg_tsv); The table never gets updated (more specifically, it gets re-created once a day with no updates in between). I w

Re: [GENERAL] Tom thinks it's bad code was 8.3 vs 8.2 sql compatibility issue

2007-11-17 Thread Tom Hart
Joshua D. Drake wrote: in the least. If you post publicly something that is that ugly, then it is going to get critiqued. It is that simple. You don't like it, don't post. I have more than once taken my beatings on this list. It is time for you to either grow a thicker skin or unsubscribe. Jo

[GENERAL] Query Performance Test

2007-11-17 Thread dcrespo
Hello, All. I have a query that I want to test twice to see its performance with and without another program running (anti-virus program). I know that if you run the same query for the second time, it will be faster than the first time. So, how can I do to execute it as if it was the first time ag

[GENERAL] Clustered/covering indexes (or lack thereof :-)

2007-11-17 Thread adrobj
This is probably a FAQ, but I can't find a good answer... So - are there common techniques to compensate for the lack of clustered/covering indexes in PostgreSQL? To be more specific - here is my table (simplified): topic_id int post_id int post_text varchar(1024) The most used query is: S

Re: [GENERAL] Chunk Delete

2007-11-17 Thread Csaba Nagy
[snip] > With Oracle we do it with: delete ,tname> where and rownum < > Y; > Can we have the same goody on Postgres? The attached message is Tom's response to a similar question, in any case it would work fine in your case too (assuming you have postgres 8.2). HTH, Csaba. --- Begin Message -

Re: [GENERAL] regexp_replace() function in new version

2007-11-17 Thread Scott Marlowe
On Nov 14, 2007 7:53 AM, Abhijeet <[EMAIL PROTECTED]> wrote: > Hi, > > regexp_replace() function in new version of PostgreSQL is giving error. > > I am trying to remove tags from string. > > I have tried following regex in & function: > > SELECT regexp_replace('Abhijeet', > '<(\s)*/?(?i:script|i|b|

Re: [GENERAL] ERROR: invalid restriction selectivity: 224359728.000000

2007-11-17 Thread Scott Marlowe
On Nov 16, 2007 11:59 AM, <[EMAIL PROTECTED]> wrote: > Hello! > Process postmaster completly eat my proccessor for a long time and i see that > message in logs. > Does anybody know what does the subj means and why it occures ? You're giving us WAY too little information to troubleshoot this probl

[GENERAL] how should I do to disable the foreign key in postgres?

2007-11-17 Thread froast
in mysql, I used :"set foreign_key_check = 0;" to disable the foreign key check, now I'm trying to migrate from mysql to postgres, how should I do to disable it?

Re: [GENERAL] how should I do to disable the foreign key in postgres?

2007-11-17 Thread Trevor Talbot
On 11/13/07, froast <[EMAIL PROTECTED]> wrote: > in mysql, I used :"set foreign_key_check = 0;" to disable the foreign key > check, now I'm trying to migrate from mysql to postgres, how should I do to > disable it? PostgreSQL isn't really designed to let your data be compromised. What actual prob

Re: [GENERAL] md5() sorting

2007-11-17 Thread Scott Marlowe
On Nov 12, 2007 1:53 PM, Lew <[EMAIL PROTECTED]> wrote: > Karsten Hilbert wrote: > > On Wed, Nov 07, 2007 at 05:36:47PM +0200, Marko Kreen wrote: > > > I'm wondering if you cast the md5sum as a bytea instead of text and > then sort, if that would solve it simply. > >>> Along the lines of

Re: [GENERAL] Chunk Delete

2007-11-17 Thread Gregory Stark
"Abraham, Danny" <[EMAIL PROTECTED]> writes: > Hi, > > I am wondering if I can do in PG Chunck Delete, like the Oracle example > below. > > In Oracle we erase 50,000 records using the following: > > Delete where and ROWNUM < 5; > > Do we have such a feature in PG? You can still use a subqu

Re: [GENERAL] Variable LIMIT and OFFSET in SELECTs

2007-11-17 Thread Gregory Stark
"Reg Me Please" <[EMAIL PROTECTED]> writes: > Of course, in my opinion at least, there's no real reason for the above > syntax limitation, as the sematics is not. Is not what? Is not sensible? > create or replace function f_limoff_1( l int, o int ) > returns setof atable as $$ > select * from at

Re: [GENERAL] Primary Key

2007-11-17 Thread Gregory Stark
"Ron Johnson" <[EMAIL PROTECTED]> writes: > On 11/16/07 12:50, João Paulo Zavanela wrote: >> Hello, >> >> How many fields is recomended to create a primary key? >> I'm thinking to create one with 6 fields, is much? > > The number of recommended fields is the *minimum* number required > for unique

Re: [GENERAL] Variable LIMIT and OFFSET in SELECTs

2007-11-17 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Sam Mason <[EMAIL PROTECTED]> writes: >> In relational algebra terms, try thinking about what would happen if you >> did something like: > >> SELECT * FROM foo LIMIT val; > >> Where the table foo has more than one row (and val had different values >> for

Re: [GENERAL] Primary Key

2007-11-17 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/17/07 01:21, Gregory Stark wrote: > "Ron Johnson" <[EMAIL PROTECTED]> writes: > >> On 11/16/07 12:50, João Paulo Zavanela wrote: >>> Hello, >>> >>> How many fields is recomended to create a primary key? >>> I'm thinking to create one with 6 fiel

Re: [GENERAL] how should I do to disable the foreign key in postgres?

2007-11-17 Thread A. Kretschmer
am Wed, dem 14.11.2007, um 15:16:48 +0800 mailte froast folgendes: > in mysql, I used :"set foreign_key_check = 0;" to disable the foreign key > check, now I'm trying to migrate from mysql to postgres, how should I do > to disable it? You can define the constraints as deferrable. Later you can