Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-04-20 Thread Tom Lane
Mike Frysinger [EMAIL PROTECTED] writes: $ pg_dump -F c -s -d database-server mydb mydb.schema $ psql -d mydb mydb.schema error about users_idx not existing pg_dump -Fc does not produce a file that psql can read directly. Is the above really what you did? regards,

Re: [GENERAL] Unexplained case insensitive results

2007-04-20 Thread Peter Eisentraut
Lloyd Mason wrote: I have also tried the query using the same encoding with both the 8.1.5 and 8.1.8 versions and the query is still coming back with different results. He said locale, not encoding. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end

Re: [GENERAL] Download source

2007-04-20 Thread Andrew Toth
2007. 04. 19, csütörtök keltezéssel 16.09-kor Alvaro Herrera ezt írta: Andrew Toth wrote: 2007. 04. 18, szerda keltezéssel 18.21-kor Alvaro Herrera ezt írta: Andrew Toth wrote: Dear List, I would like to download the version of source code containing catversion.h with

Re: [GENERAL] SQL WHERE: many sql or large IN()

2007-04-20 Thread Chris
tom wrote: This is some good stuff and I can use the explain analyze going forward. But I can't get these VALUES queries to work. I checked and I am on version 8.1. but I think from the docs that I should still be able to do this. Multiple VALUES was introduced in 8.2 as others mentioned so

Re: [GENERAL] dollar-quoting trouble

2007-04-20 Thread Karsten Hilbert
On Fri, Apr 20, 2007 at 12:40:45PM +1000, Klint Gore wrote: I can't spot the trouble with this function definition: ... PostgreSQL 8.1.8 (Debian/Etch) is telling me: Actually, Lenny. psql:dem-identity.sql:43: ERROR: unterminated dollar-quoted string at or near $null_empty_title$ begin

Re: [GENERAL] dollar-quoting trouble

2007-04-20 Thread Shane Ambler
Karsten Hilbert wrote: Does psql --version match select version()? There's a message in the archive pgsql-bugs where this happened. That was indeed part of the trouble: Both 7.4.16 and 8.1.8 being installed on Debian I couldn't get the default psql be 8.1 despite using update-alternatives.

[GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Tilmann Singer
Hi, In this http://archive.netbsd.se/?ml=pgsql-hackersa=2006-10t=2475028 thread Teodor Sigaev describes a way to make tsearch2 index substrings of words: Brain storm method: Develop a dictionary which returns all substring for lexeme, for example for word foobar it will be 'foobar fooba

Re: [GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Listmail
You want trigram based search. ie. postgresql - 'pos', 'ost', 'stg', 'tgr', 'gre', 'res', 'esq', 'sql' searching for 'gresq' is searching for 'gre' and 'res' and 'esq' which is good friends with bitmap scan. Then a little LIKE '%gresq%' to filter the results.

Re: [GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Oleg Bartunov
On Fri, 20 Apr 2007, Tilmann Singer wrote: Hi, In this http://archive.netbsd.se/?ml=pgsql-hackersa=2006-10t=2475028 thread Teodor Sigaev describes a way to make tsearch2 index substrings of words: Brain storm method: Develop a dictionary which returns all substring for lexeme, for example

Re: [GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Tilmann Singer
* Listmail [EMAIL PROTECTED] [20070420 11:25]: You want trigram based search. ie. postgresql - 'pos', 'ost', 'stg', 'tgr', 'gre', 'res', 'esq', 'sql' searching for 'gresq' is searching for 'gre' and 'res' and 'esq' which is good friends with bitmap

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-04-20 Thread Mike Frysinger
On 4/20/07, Tom Lane [EMAIL PROTECTED] wrote: Mike Frysinger [EMAIL PROTECTED] writes: $ pg_dump -F c -s -d database-server mydb mydb.schema $ psql -d mydb mydb.schema error about users_idx not existing pg_dump -Fc does not produce a file that psql can read directly. Is the above really

Re: [GENERAL] Need help with db script, and daily routines

2007-04-20 Thread Richard Huxton
Peter Neu wrote: Thanks. This script looks good. :o) How do I call it once a day with a cron job on my linux box? Put the script in a file (e.g. expiry_script.sql) then add to your crontab: /path/to/psql -U username -d database -f /path/to/expiry_script.sql -q See man psql, man 5 crontab

Re: [GENERAL] Technical Documentation and Community Login

2007-04-20 Thread George Weaver
Original Message From Guy Rouillier http://www.postgresql.org/docs/techdocs.71. Color me dumb, but I can't figure a way to download the document Apache 2.0, Tomcat 5.5, WARs PostgreSQL 8.1 JDBC DataSources on Windows XP. When I click on the link to the document, it just brings me back to

Re: [GENERAL] selective export for subsequent import (COPY)

2007-04-20 Thread chrisj
Thanks Brent, very much appreciated, your first suggestion is perfect. the translate suggestion assumes that there are no commas in the data, but that is why I wanted to use tab. again, thanks a lot!! Brent Wood wrote: chrisj wrote: Thanks Alan, This helped a lot, but ideally I want a

Re: [GENERAL] selective export for subsequent import (COPY)

2007-04-20 Thread chrisj
Hi Tom, It appears to me that the documentation suggests that: -P fieldsep='\t' should work, but I don't think it does. Tom Lane-2 wrote: chrisj [EMAIL PROTECTED] writes: This helped a lot, but ideally I want a tab field delimiter and -F '\t' does not seem to work, any ideas?? I

Re: [GENERAL] Building PG 8.2.3 for x86_64 on Mac OS X 10.4.9

2007-04-20 Thread Tom Lane
Kevin Murphy [EMAIL PROTECTED] writes: Tom Lane wrote: Hmm ... not sure if this is related, but there's something mighty fishy about that key parameter. I'd expect to see key=5432001, or something close to that depending on what port number you're using. But is this the case when doing

Re: [GENERAL] Building PG 8.2.3 for x86_64 on Mac OS X 10.4.9

2007-04-20 Thread Kevin Murphy
Tom Lane wrote: Kevin Murphy [EMAIL PROTECTED] writes: Has anybody tried making a 64-bit PostgreSQL on an Apple XServe w/ Intel Woodcrest CPU's? creating template1 database in /usr/local/src/postgresql-8.2.3/src/ test/regress/./tmp_check/data/base/1 ... FATAL: \ could not create

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-04-20 Thread Tom Lane
Mike Frysinger [EMAIL PROTECTED] writes: i was experimenting with using pg_dump/pg_restore and pg_dump/psql ... when using psql to import, i didnt use -Fc ... but the errors were the same regardless of whether i used pgsl or pg_restore ;( Well, the whole thing is pretty strange, because AFAICS

[GENERAL] nedd help bytea encode

2007-04-20 Thread marcelo Cortez
folks I need help my client application need to save rtf text format, i'm codding string data into bytea format by hand but without success need some body check this input sample data: '{\rtf1\ansi }' output codding

[GENERAL] Schema relationship diagram

2007-04-20 Thread RPK
Is there any feature in PGSQL to view the schema relationship diagram? -- View this message in context: http://www.nabble.com/Schema-relationship-diagram-tf3619278.html#a10105662 Sent from the PostgreSQL - general mailing list archive at Nabble.com. ---(end of

[GENERAL] returning setof varchar

2007-04-20 Thread Scott Schulthess
How do I get this to work? create or replace function getquadalphabet(text) returns setof varchar as $$ declare r varchar; begin for r in SELECT distinct(substring(drgtitle, 1, 1)) as text from stockdrgmeta where state ilike '%' || $1 || '%' LOOP return next r; END LOOP; end; $$

Re: [GENERAL] returning setof varchar

2007-04-20 Thread Jeff Davis
On Fri, 2007-04-20 at 12:00 -0400, Scott Schulthess wrote: create or replace function getquadalphabet(text) returns setof varchar as $$ declare r varchar; begin for r in SELECT distinct(substring(drgtitle, 1, 1)) as text from stockdrgmeta where state ilike '%' || $1 || '%' LOOP

Re: [GENERAL] Schema relationship diagram

2007-04-20 Thread A. Kretschmer
am Fri, dem 20.04.2007, um 9:22:21 -0700 mailte RPK folgendes: Is there any feature in PGSQL to view the schema relationship diagram? You can use tools like postgresql-autodoc for this. Description: utility to create system tables overview in HTML, DOT and XML This is a utility which will

Re: [GENERAL] Technical Documentation and Community Login

2007-04-20 Thread Guy Rouillier
George Weaver wrote: Original Message From Guy Rouillier http://www.postgresql.org/docs/techdocs.71. Color me dumb, but I can't figure a way to download the document Apache 2.0, Tomcat 5.5, WARs PostgreSQL 8.1 JDBC DataSources on Windows XP. When I click on the link to the document, it

Re: [GENERAL] Technical Documentation and Community Login

2007-04-20 Thread Magnus Hagander
Guy Rouillier wrote: George Weaver wrote: Original Message From Guy Rouillier http://www.postgresql.org/docs/techdocs.71. Color me dumb, but I can't figure a way to download the document Apache 2.0, Tomcat 5.5, WARs PostgreSQL 8.1 JDBC DataSources on Windows XP. When I click on the link

Re: [GENERAL] binding 64-bit integer

2007-04-20 Thread [EMAIL PROTECTED]
After change the SQL clause to SELECT * from mytable WHERE mykey=$1::int8, the binding passed! Thanks for everyone's reply. - Original Message From: Tom Lane [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Sent: Thursday, April 19, 2007

Re: [GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Listmail
I'm aware of that and in my case I don't think it will be a problem. It is for a type-ahead search web interface so actually it only requires indexing all possible substrings starting from char 1, ie. p, po, pos, post, postg, postgr, postgre, postgres, postgresq, postgresql. If you want to

Re: [GENERAL] Technical Documentation and Community Login

2007-04-20 Thread Stefan Kaltenbrunner
Magnus Hagander wrote: Guy Rouillier wrote: George Weaver wrote: Original Message From Guy Rouillier http://www.postgresql.org/docs/techdocs.71. Color me dumb, but I can't figure a way to download the document Apache 2.0, Tomcat 5.5, WARs PostgreSQL 8.1 JDBC DataSources on Windows XP.

[GENERAL] Upgrading a 32-bit build to a 64-bit build

2007-04-20 Thread Steven Flatt
I can't seem to find an answer to this. If I upgrade a 32-bit Postgres build to a 64-bit Postgres build (same version), will the data files be compatible or do I have to do a dump and restore of the database? Is the answer the same for 8.1 and 8.2? Steve

Re: [GENERAL] Upgrading a 32-bit build to a 64-bit build

2007-04-20 Thread Douglas McNaught
Steven Flatt [EMAIL PROTECTED] writes: I can't seem to find an answer to this. If I upgrade a 32-bit Postgres build to a 64-bit Postgres build (same version), will the data files be compatible or do I have to do a dump and restore of the database? They will not be compatible. Is the

[GENERAL] large table problem

2007-04-20 Thread Jason Nerothin
I'm trying to work my way around a large query problem. In my system, I've created a number of large materialized views that are the output of some computationally expensive stored procedures on other large tables in my system. They are intended to serve as staging tables for the next phase of

[GENERAL] error:varchar too long - how to get details?

2007-04-20 Thread Kacper Chrapa
Hi everyone ! I've got a little question :-) When I try to insert too long string into some varchar(n) column,i get a message like this: ERROR:value too long for type character varying(10) It's ok - but how can I get information,which column generates an error? Is it possible ? I don't see

[GENERAL] tsearch2 dictionary that indexes substrings?

2007-04-20 Thread Tilmann Singer
Hi, In this http://archive.netbsd.se/?ml=pgsql-hackersa=2006-10t=2475028 thread Teodor Sigaev describes a way to make tsearch2 index substrings of words: Brain storm method: Develop a dictionary which returns all substring for lexeme, for example for word foobar it will be 'foobar fooba

Re: [GENERAL] returning setof varchar

2007-04-20 Thread Richard Huxton
Scott Schulthess wrote: How do I get this to work? for r in SELECT distinct(substring(drgtitle, 1, 1)) as text from stockdrgmeta where state ilike '%' || $1 || '%' loop variable of loop over rows must be record or row variable at or near LOOP at character 218 DECLARE r

[GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
I need a certain unique constraint in pg that i can't figure out. Given: create table test_a ( id serial , name_1 varchar(32) , name_2 varchar(32) ); I need name_1 and name_2 to both be unique so that: name_1 never

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jorge Godoy
Jonathan Vanasco [EMAIL PROTECTED] writes: I need a certain unique constraint in pg that i can't figure out. Given: create table test_a ( id serial , name_1 varchar(32) , name_2 varchar(32) ); I need name_1 and name_2 to both be

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-04-20 Thread Mike Frysinger
On 4/20/07, Tom Lane [EMAIL PROTECTED] wrote: Mike Frysinger [EMAIL PROTECTED] writes: i was experimenting with using pg_dump/pg_restore and pg_dump/psql ... when using psql to import, i didnt use -Fc ... but the errors were the same regardless of whether i used pgsl or pg_restore ;( Well,

Re: [GENERAL] cant get pg_dump/pg_restore to behave

2007-04-20 Thread Tom Lane
Mike Frysinger [EMAIL PROTECTED] writes: On 4/20/07, Tom Lane [EMAIL PROTECTED] wrote: Well, the whole thing is pretty strange, because AFAICS pg_dump will never emit an UPDATE on a user table at all. this was my understanding of pg_dump as well ... What PG version is this exactly? latest

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Vladimir Zelinski
This looks like more table design problem than database limitation. The one column should accommodate values from both columns with unique index built on this column. Your requirements tell me that these values are the same nature and should be placed in the same column. To distinguish between

Re: [GENERAL] large table problem

2007-04-20 Thread Tom Lane
Jason Nerothin [EMAIL PROTECTED] writes: Attempt number 2, now underway, is to pass LIMIT and OFFSET values to the query which Postgres handles quite effectively as long as the OFFSET value is less than the total number of rows in the table. When the value is greater than num_rows, the query

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
On Apr 20, 2007, at 5:43 PM, Vladimir Zelinski wrote: This looks like more table design problem than database limitation. The one column should accommodate values from both columns with unique index built on this column. Your requirements tell me that these values are the same nature and

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Tom Lane
Jonathan Vanasco [EMAIL PROTECTED] writes: Given: create table test_a ( id serial , name_1 varchar(32) , name_2 varchar(32) ); I need name_1 and name_2 to both be unique so that: name_1 never appears in name_1 or name_2

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jeff Davis
On Fri, 2007-04-20 at 17:56 -0400, Jonathan Vanasco wrote: On Apr 20, 2007, at 5:43 PM, Vladimir Zelinski wrote: This looks like more table design problem than database limitation. The one column should accommodate values from both columns with unique index built on this column. Your

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jonathan Vanasco
On Apr 20, 2007, at 6:13 PM, Jeff Davis wrote: This is more correct structure, and yes, it would involve a join. I know thats the 'more correct' way -- but I can't do the join , which is why I posted about a 2 column unique index. I tested with a join before posting - i have an already

Re: [GENERAL] unique constraint on 2 columns

2007-04-20 Thread Jeff Davis
On Fri, 2007-04-20 at 18:32 -0400, Jonathan Vanasco wrote: On Apr 20, 2007, at 6:13 PM, Jeff Davis wrote: This is more correct structure, and yes, it would involve a join. I know thats the 'more correct' way -- but I can't do the join , which is why I posted about a 2 column unique

[GENERAL] Passing arrays to stored procedures

2007-04-20 Thread William Garrison
I have a stored procedure that takes a list of IDs and uses the ANY operator: CREATE OR REPLACE FUNCTION CalculateTotals( customerList bytea[], out total bigint, out most_recent_login_date date) AS $$ BEGIN SELECT SUM(totalsize), MAX(last_login)

Re: [GENERAL] Passing arrays to stored procedures

2007-04-20 Thread Tom Lane
William Garrison [EMAIL PROTECTED] writes: I'm using npgsql and C#, and I've realized it doesn't support passing arrays. Barring things like updating npgsql, what form of hackiness would work best here? The customerIDs are GUIDs represented as 16-byte arrays. I can pass them as encoded

Re: [GENERAL] Passing arrays to stored procedures

2007-04-20 Thread Jorge Godoy
William Garrison [EMAIL PROTECTED] writes: WHERE customerid = ANY($1); Results in the error: ERROR: op ANY/ALL (array) requires array on right side I tried casting the character string to an array afterward: WHERE customerid = ANY($1::bytea); which results in: ERROR:

Re: [GENERAL] Schema relationship diagram

2007-04-20 Thread RPK
Where I can find this? am Fri, dem 20.04.2007, um 9:22:21 -0700 mailte RPK folgendes: Is there any feature in PGSQL to view the schema relationship diagram? You can use tools like postgresql-autodoc for this. -- View this message in context:

Re: [GENERAL] Schema relationship diagram

2007-04-20 Thread Andreas Kretschmer
RPK [EMAIL PROTECTED] schrieb: Where I can find this? Do you mean postgresql-autodoc? Depends on your distribition, i have Debian and can do a simple 'apt-get install postgresql-autodoc', if i want to install this. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a

Re: [GENERAL] Schema relationship diagram

2007-04-20 Thread RPK
quote author='Andreas Kretschmer-2' Depends on your distribition I am using pgsql 8.2.3 on Windows XP. I think open source programs are all better out for Debian like thing. They work horribly strange on Windows. -- View this message in context:

Re: [GENERAL] Passing arrays to stored procedures

2007-04-20 Thread William Garrison
Yeah, I meant bytea[]. It still doesn't work. Same error: ERROR: cannot cast type character varying to bytea[] Not that this is not the same as doing select '{1, 2, 3}'::int[]. This is the equivalent of doing SELECT ('{1, 1, 1, 1}'::varchar(255))::int[]; I