Re: [GENERAL] assigning password from script

2007-07-03 Thread Ashish Karalkar
- Original Message - 2007/7/2, Ashish Karalkar [EMAIL PROTECTED]: Hello All, I want to create a user through script and dont want user to assign password interactively, I want it to be assigned through some file or anything else some this like createuser -P * OR createuser

Re: [GENERAL] assigning password from script

2007-07-03 Thread Pavel Stehule
Hello try psql postgres -c create role tom login password 'hello' Regards Pavel 2007/7/3, Ashish Karalkar [EMAIL PROTECTED]: - Original Message - 2007/7/2, Ashish Karalkar [EMAIL PROTECTED]: Hello All, I want to create a user through script and dont want user to assign

Re: [GENERAL] Tables not created in proper schema

2007-07-03 Thread Albe Laurenz
Ashish Karalkar wrote: ${PG_PATH}/psql -d qsweb --command CREATE SCHEMA qsweb ${PG_PATH}/psql -d qsweb --command ALTER SCHEMA qsweb OWNER TO qsweb ${PG_PATH}/psql --command ALTER USER qsweb SET SEARCH_PATH='qsweb' The output is right till alter schema but then while setting the

Re: [GENERAL] How-To: Aggregate data from multiple rows into a delimited list.

2007-07-03 Thread Dimitri Fontaine
Le lundi 02 juillet 2007, D. Dante Lorenso a écrit : I wanted to select several rows of data and have them returned in a single record with the rows joined by a delimiter. Turns out this is very easy to do in PostgreSQL: SELECT a.id, a.name, ARRAY_TO_STRING(ARRAY( SELECT

Re: [GENERAL] General search problem - challenge

2007-07-03 Thread Richard Huxton
Postgres User wrote: I have a table of around 6,000 places in the world. Everytime my server receives a ping, I'm grabbing the content of an article from an RSS feed. Then I search the article for the presence of any the 6000 terms. A typical article is around 1200 words. I don't need to save

Re: [GENERAL] How-To: Aggregate data from multiple rows into a delimited list.

2007-07-03 Thread Pavel Stehule
The query would become SELECT a.id, a.name, array_acc(b.name) as b_names FROM a LEFT JOIN b USING(id) GROUP BY a.id, a.name; All variants are possible. Variant with array_to_string is faster and doesn't need own aggregate function. And you can easy remove duplicities. SELECT a.id, a.name,

Re: [GENERAL] Invalid page header

2007-07-03 Thread Poul Møller Hansen
I had a similar problem and overcame it by temporarily setting zero_damaged_pages, then doing a full vacuum and re-index on the affected table. Thanks, I suppose I need to reindex the table afterwards, or they can point to non existent data ? Poul ---(end of

Re: [GENERAL] Invalid page header

2007-07-03 Thread Poul Møller Hansen
and re-index on the affected table. Sorry, was to fast Poul ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not

Re: [GENERAL] recovery_target_time ignored or recovery always recov ersto end of WAL

2007-07-03 Thread Jason Buberel
LOL. Thats what i get for running configure and make with PG_HOME set to my 8.1.4 install. With that fixed i will start probing my WAL archives now. -jason --- Original Message --- From: Tom Lane [EMAIL PROTECTED] To: Jason L. Buberel [EMAIL PROTECTED] Sent: 7/2/2007, 1:33:24 PM

[GENERAL] how to: psql -U user --password password ?

2007-07-03 Thread Stefan Zweig
Hi list, i have a problem with connecting to postgresql on a remote server. basically i want to import some sets of data into the database, using the psql command from within a shell script. i have a local machine where postgres is installed and a remote one where postgres is installed as

Re: [GENERAL] how to: psql -U user --password password ?

2007-07-03 Thread Ashish Karalkar
Hello Stefan, Recently I Have faced this problem and solved by .pgpass file approch Take alook on http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html With Regards Ashish... - Original Message - From: Stefan Zweig [EMAIL PROTECTED] To: pgsql-general@postgresql.org

Re: [GENERAL] how to: psql -U user --password password ?

2007-07-03 Thread Viatcheslav Kalinin
http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html or you can set PGPASSWORD environment variable (not recommended though) Stefan Zweig wrote: Hi list, i have a problem with connecting to postgresql on a remote server. basically i want to import some sets of data into the

Re: [GENERAL] how to: psql -U user --password password ?

2007-07-03 Thread Raymond O'Donnell
On 03/07/2007 13:47, Stefan Zweig wrote: i know already that there is a way to connect to a remote postgres using psql with the options --host 123.123.123.1 --port 5432 --username --password You can specify the username on the command line, but not the password: the --password option only

Re: [GENERAL] how to: psql -U user --password password ?

2007-07-03 Thread Peter Wiersig
On Tue, Jul 03, 2007 at 02:47:58PM +0200, Stefan Zweig wrote: i appreciate any help. man psql: It is also convenient to have a ~/.pgpass file to avoid regularly having to type in passwords. See the documentation for more information. Peter ---(end of

[GENERAL] Check whether two strs have at least one shared character.

2007-07-03 Thread Emi Lu
Hello, Is there a simple way/command/function to check whether two strings have at least one overlap character please? For example, str1: 05baaa str2: ooboo Query: select str1 ??? str2 ; Result: true Because b is in both str1 and str2. Thank you! ---(end of

Re: [GENERAL] Check whether two strs have at least one shared character.

2007-07-03 Thread Albe Laurenz
Emi Lu wrote: Is there a simple way/command/function to check whether two strings have at least one overlap character please? For example, str1: 05baaa str2: ooboo Query: select str1 ??? str2 ; Result: true Because b is in both str1 and str2. SELECT str1 ~ ( '[' || str2 || ']');

Re: [GENERAL] recovery_target_time ignored or recovery always recovers to end of WAL

2007-07-03 Thread Tom Lane
Jason L. Buberel [EMAIL PROTECTED] writes: Instead, in order to achieve my goal I would have to restore to that backup, and rely on the contents of the archive_logs to have the recovery process return me to the selected xid PITR. Correct. So is there any way to 'trick' or force the server

Re: [GENERAL] recovery_target_time ignored or recovery always recovers to end of WAL

2007-07-03 Thread Erik Jones
On Jul 2, 2007, at 11:58 PM, Jason L. Buberel wrote: I am now learning that fact, but recall the original scenario that I am trying to mimic: 1. Person accidentally deletes contents of important table. 2. Admin (me) wants to roll back db state to just prior to that deletion. 3. (Me)

Re: [GENERAL] recovery_target_time ignored or recovery always recovers to end of WAL

2007-07-03 Thread Jason L. Buberel
Understood all around - thanks to everyone for helping me clarify (in my head/understanding) how these pieces fit together. One last request - can you glance over the plan below and let me know if it sounds sane? The goal again is to be able to recover to a PITR record in the very recent past

[GENERAL] Trigger Priority

2007-07-03 Thread Mike Gould
Is there a way to determine the order that triggers are executed? We are converting from SQL Anywhere 9 and one of the features that they have is the ability to add a order statement to triggers. This allows from a programmatic way to control how triggers are fired if there is more than

Re: [GENERAL] Trigger Priority

2007-07-03 Thread Richard Broersma Jr
--- Mike Gould [EMAIL PROTECTED] wrote: Is there a way to determine the order that triggers are executed? We are converting from SQL Anywhere 9 and one of the features that they have is the ability to add a order statement to triggers. This allows from a programmatic way to control

Re: [GENERAL] Trigger Priority

2007-07-03 Thread A. Kretschmer
am Tue, dem 03.07.2007, um 12:11:01 -0400 mailte Mike Gould folgendes: Is there a way to determine the order that triggers are executed? We are alphabetically Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header) GnuPG-ID: 0x3FFF606C, privat

Re: [GENERAL] What O/S or hardware feature would be useful for databases?

2007-07-03 Thread Merlin Moncure
On 7/2/07, Ron Johnson [EMAIL PROTECTED] wrote: On 06/18/07 08:05, Merlin Moncure wrote: [snip] That being said, it's pretty clear to me we are in the last days of the disk drive. Oh, puhleeze. Seagate, Hitachi, Fuji and WD aren't sitting around with their thumbs up their arses.In 3-4

[GENERAL] Date for a week day of a month

2007-07-03 Thread Emi Lu
Hello, Can I know how to get the date of each month's last Thursday please? For example, something like Query: select getDateBaseOnWeekday('2007-04-01', 'Last Thursday'); Result: 2007-04-26 Thank you! ---(end of broadcast)--- TIP 1: if

[GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Charles Pare
Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable which contain my path, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL statement in

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Charles Pare wrote: Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable which contain my path, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread A. Kretschmer
am Tue, dem 03.07.2007, um 14:27:24 -0400 mailte Emi Lu folgendes: Hello, Can I know how to get the date of each month's last Thursday please? For example, something like Query: select getDateBaseOnWeekday('2007-04-01', 'Last Thursday'); Result: 2007-04-26 Write you own function. You

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Nick Barr
Emi Lu wrote: Hello, Can I know how to get the date of each month's last Thursday please? For example, something like Query: select getDateBaseOnWeekday('2007-04-01', 'Last Thursday'); Result: 2007-04-26 Thank you! CREATE OR REPLACE FUNCTION lastday (date,int) RETURNS DATE AS ' DECLARE

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Charles Pare
Wow, it works greatThank's for the quick answerThe Postgres community is amazing!Charles Date: Tue, 3 Jul 2007 20:01:03 +0100 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: pgsql-general@postgresql.org Subject: Re: [GENERAL] Stored Procedure: Copy table from; path = text variable Charles

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Michael Glaesemann
On Jul 3, 2007, at 13:27 , Emi Lu wrote: Can I know how to get the date of each month's last Thursday please? For example, something like Query: select getDateBaseOnWeekday('2007-04-01', 'Last Thursday'); Result: 2007-04-26 Using a function for calculating the first occurrence of a

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Emi Lu
Thank you all for your inputs! Based on your inputs, made it a bit change to my application: == DROP FUNCTION test_db.lastWeekdayDate (date, varchar) ; CREATE OR REPLACE FUNCTION test_db.lastWeekdayDate

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Nick Barr
Emi Lu wrote: Hello, Can I know how to get the date of each month's last Thursday please? For example, something like Query: select getDateBaseOnWeekday('2007-04-01', 'Last Thursday'); Result: 2007-04-26 Thank you! It turns out my original solution was slightly (badly) wrong and was

Re: [GENERAL] Date for a week day of a month

2007-07-03 Thread Michael Glaesemann
On Jul 3, 2007, at 14:54 , Emi Lu wrote: result := ( (date_part('year', $1) || '-' || date_part('month', $1) || '-01')::date + '1 month'::interval - '1 day'::interval )::date; I recommend not using string manipulation to handle data that

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) The Postgres community is amazing! Mostly by volunteers helping out on lists :-) There's always someone out there you can lend a helping hand

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Dave Page
Richard Huxton wrote: Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) Yeah, that's really quite disappointing Richard - you need to pull your socks up :-) /D ---(end

Re: [GENERAL] Stored Procedure: Copy table from; path = text variable

2007-07-03 Thread Richard Huxton
Dave Page wrote: Richard Huxton wrote: Charles Pare wrote: Wow, it works great Thank's for the quick answer 12 minutes? I've seen bug-patches turned around quicker than that by Tom ;-) Yeah, that's really quite disappointing Richard - you need to pull your socks up :-) Would have been

[GENERAL] How do I aggregate data from multiple rows into a delimited list?

2007-07-03 Thread D. Dante Lorenso
I want to select several rows of data and have them returned in a single record with the rows joined by a delimiter. It would be great if this could be done in a generic way possibly using the GROUP BY like this: SELECT a.id, a.name, STR_SUM(b.name, ',') AS b_names FROM a, b WHERE

[GENERAL] [pgsql.general] Problem connecting PostgreSQL 8.2 to Rails 1.2

2007-07-03 Thread Bjorn Boulder
Hello people, I just installed PostgreSQL on my Mac. I used the package available here: http://www.entropy.ch/software/macosx/postgresql/ Here is a screendump of initdb... $ $ $ $ $ /usr/local/bin/initdb -E UTF8 -D /usr/local/pgsql/data The files belonging to this database system will be owned

Re: [GENERAL] Problem connecting PostgreSQL 8.2 to Rails 1.2

2007-07-03 Thread Bjorn Boulder
People, I found the answer here: http://wiki.rubyonrails.org/rails/pages/PostgreSQL I fixed it with 1 (one!) command line: gem install postgres -- --with-pgsql-include-dir=/usr/local/pgsql/include --with-pgsql-lib-dir=/usr/local/pgsql/lib More info: $ $ $ gem install postgres --

Re: [GENERAL] What O/S or hardware feature would be useful for databases?

2007-07-03 Thread Ron Johnson
On 07/03/07 13:03, Merlin Moncure wrote: On 7/2/07, Ron Johnson [EMAIL PROTECTED] wrote: On 06/18/07 08:05, Merlin Moncure wrote: [snip] That being said, it's pretty clear to me we are in the last days of the disk drive. Oh, puhleeze. Seagate, Hitachi, Fuji and WD aren't sitting around

[GENERAL] Stored Procedure: COPY table FROM (where path is a text variable)

2007-07-03 Thread Charles Pare
Hi, in a stored procedure, if I do COPY table FROM 'mypath' DELIMITERS '\t'; it works but if my path is a text variable, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it doesn't work, I get ERROR: syntax error at or near $1SQL state: 42601Context: SQL statement in PL/PgSQL function parseinsert

Re: [GENERAL] SQL problem..

2007-07-03 Thread Bauhaus
thnx ! ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

[GENERAL] HAVING clause working in postgres 8.0, but not in 8.2

2007-07-03 Thread ujkavlade
Hello all, We have recently upgrade our postgres server from 8.0 to 8.2. I am experiencing some difficulties in SQL queries. Let's say I have a table NUMBERS (number (integer)) which has values 1, 5 and 8. SELECT number FROM numbers; will return 1, 5 and 8. In PostgreSql 8.0, SELECT number FROM

[GENERAL] Insert speed

2007-07-03 Thread Terry Fielder
I have a user application use log. Under pg 7.x the system performed fine. In 8.1, the insert statements seem to take a long time sometimes, upto several seconds or more. Here is the table: CREATE TABLE user_app_use_log ( user_id int4 NOT NULL, access_stamp timestamptz NOT NULL DEFAULT

[GENERAL] how to covert a column?

2007-07-03 Thread Dimitrius Weddington
HI All, I have a dataset (90GBs worth) that contains 3 columns of unix timestamps in seconds. Ideally, I want to use copy to load the data into the DB (the disk i/o of trying to process this volume of data vi perl takes a couple of days). I was hoping to convert the unix timestamps inside the

[GENERAL] Best possible way of exporting data to a generic file format

2007-07-03 Thread dcrespo
Hi, I'm working on an extraction tool that should unload timestamp-ranged data from every table of a selected schema under postgresql database, and store its result into a file so it can be loaded into any database. I don't know what tables I'm going to dump, but I do know what fields should be

[GENERAL] Design Tool

2007-07-03 Thread Gabriele
I need a design tool to design my database. Back in past I used DBDesigner (free) but it is best suited to MySQL and i now use PostGreSQL and SQLite. The tool should have most of the following: Ability to create a rather complex and arbitrarily big scheme and produce automatically the SQL code

[GENERAL] Delete Performance question

2007-07-03 Thread Niederland
I did an analyize and tried to delete 50 rows from the 1.5M table and it took over 120 seconds. Deleting 100 rows took nearly twice as long. An explain of the delete query showed that indexes were being used. I found that changing the variable enable_seqscan = off and restarting the database,

[GENERAL] Reasonable way to backup cluster Windows

2007-07-03 Thread Andrus
pg doc recommends to use pg_dumpall -c | gzip backup.gz In windows it writes whole file in uncompressed form to temporary file and only then runs gzip. This requires large amout of free disk space in temporary file space and thus is not reasonable. Which is reasonable way to backup cluster

Re: [GENERAL] HAVING clause working in postgres 8.0, but not in 8.2

2007-07-03 Thread Tom Lane
[EMAIL PROTECTED] writes: In PostgreSql 8.0, SELECT number FROM numbers HAVING number = 5; returns 5 But in 8.2, it gives me the following error: ERROR: column numbers.number must appear in the GROUP BY clause or be used in an aggregate function. In the documentation, it says that HAVING

[GENERAL] Mugs 'n stuff

2007-07-03 Thread Raymond O'Donnell
Hi all, Is it still possible to get PostgreSQL merchandise? A friend of mine is looking for some, but I can't seem to find where its available. I have a PostgreSQL mug I bought some years ago, which sparked this search (I know, I need a life...) :-) Ray.

[GENERAL] bad function lets postgres crash

2007-07-03 Thread Clemens Schwaighofer
hi, Although I do a lot with postgres, I am quite new to functions. So yesterday I was playing around with a very simple one. Of course I did something very stupid and created an infinite loop in the end. My problem is, that this crashed one of my postgres server, but the other just through an

Re: [GENERAL] bad function lets postgres crash

2007-07-03 Thread Tom Lane
Clemens Schwaighofer [EMAIL PROTECTED] writes: both servers are debian packages 8.1.9-1, but on the one that crashed I increased the stack depth to 8192. Could it be that postgres ran out of memory and terminated itself? Increasing the stack depth parameter to more than what the kernel really

Re: [GENERAL] How do I aggregate data from multiple rows into a delimited list?

2007-07-03 Thread Berend Tober
D. Dante Lorenso wrote: I want to select several rows of data and have them returned in a single record with the rows joined by a delimiter. Review the User Comments at http://www.postgresql.org/docs/8.0/interactive/sql-createaggregate.html; for some ideas.

Re: [GENERAL] Mugs 'n stuff

2007-07-03 Thread A. Kretschmer
am Tue, dem 03.07.2007, um 23:37:57 +0100 mailte Raymond O'Donnell folgendes: Hi all, Is it still possible to get PostgreSQL merchandise? A friend of mine is looking for some, but I can't seem to find where its available. Can you or your fried visit the pgday.it at Prato, Italy?

Re: [GENERAL] How do I aggregate data from multiple rows into a delimited list?

2007-07-03 Thread Chris
D. Dante Lorenso wrote: I want to select several rows of data and have them returned in a single record with the rows joined by a delimiter. I have something like that here: http://www.designmagick.com/article/38 -- Postgresql php tutorials http://www.designmagick.com/