Re: [GENERAL] Question about COPY command

2009-01-09 Thread Ragnar Hafstað
On fim, 2009-01-08 at 08:39 -0500, Josh Harrison wrote: Hi, A basic question about the COPY command syntax This is the syntax in the postgres manual. COPY tablename [ ( column [, ...] ) ] FROM { 'filename' | STDIN } .. . What is the difference between copying from

Re: [GENERAL] Query questions

2005-09-03 Thread Ragnar Hafstað
On Sat, 2005-09-03 at 00:59 -0800, Poul Jensen wrote: I'm building a database containing key parameters for ~500,000 data files. The design I found logical is Two tables for each file: 1) Larger table with detailed key parameters (10-15 columns, ~1000 rows), call it large_table 2)

Re: : Re: [GENERAL] A strange problem

2005-08-28 Thread Ragnar Hafstað
On Sun, 2005-08-28 at 16:22 +0800, Tang Tim Hei wrote: The following commands are little different from the previous one. (1) select A.* from test.currency A, test.price_list B where A.curr_cd=B.curr_cd and A.curr_cd='USD' (2) select A.* from test.currency A, test.price_list B, test.country

Re: [GENERAL] Index not being used unless enable_seqscan=false

2005-08-10 Thread Ragnar Hafstað
On Wed, 2005-08-10 at 12:01 -0700, Shane wrote: Hello all, I am working with a simple table and query abut cannot seem to get it to use the index I have created. However, if I set enable_seqscan=false, the index is used and the query is much faster. I have tried a vacuum analyze but to no

Re: [GENERAL] Suppressing Error messages.

2005-08-10 Thread Ragnar Hafstað
On Fri, 2005-08-05 at 07:42 -0700, Basith Salman wrote: Hi All, I was wondering if there is way to suppress the error messages on the stdout from a perl dbi execute command, basically if I do a sth-execute() on a command and say the row cannot be updated then I get a err msg to stdout

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Ragnar Hafstað
On Fri, 2005-08-05 at 10:53 -0500, Yudie Pg wrote: Hi everyone, I have a function returning set of date called datelist(date,date) example: select * from datelist('8/1/2005, 8/5/2005'); 8/1/2005 8/2/3005 8/3/2004 8/4/2005 8/5/2005 I would like to join this function with a table

Re: [GENERAL] Cost problem

2005-08-03 Thread Ragnar Hafstað
On Tue, 2005-08-02 at 17:32 +0300, Victor wrote: Hello. I use psql (PostgreSQL) 7.4.5. I have a cost problem. A simple select lasts too long. I have a table with aprox 900 rows. All rows are deleted and reinserted once a minute. EXPLAIN ANALYZE SELECT * FROM logati;

Re: [GENERAL] postgresql.conf value need advice

2005-08-03 Thread Ragnar Hafstað
On Wed, 2005-08-03 at 13:30 -0300, marcelo Cortez wrote: folks what is preferible value for stats_reset_on_server_start ? depends on whether you want stats to be accumulated for longer periods than between restarts. I imagine that 'on' is what most people need. in any case, you can reset

Re: [GENERAL] indexes are fucked

2005-08-02 Thread Ragnar Hafstað
On Tue, 2005-08-02 at 10:04 -0700, Dr NoName wrote: I got another problem with postgres. This time it refuses to use the indexes. Check this out: [snip] siam_production= explain SELECT render.* FROM render WHERE person_id = 432; QUERY PLAN

Re: [GENERAL] indexes are fucked

2005-08-02 Thread Ragnar Hafstað
On Tue, 2005-08-02 at 10:50 -0700, Dr NoName wrote: What is the output of these: set enable_seqscan = off; explain SELECT render.* FROM render WHERE person_id = 432; QUERY PLAN

Re: [GENERAL] hpw to Count without group by

2005-06-01 Thread Ragnar Hafstað
On Wed, 2005-06-01 at 16:16 -0500, Yudie Pg wrote: Hello, I have a table, structure like this: [...] Expected query result: sku, category, display_name, category_count 10001, 5, postgresql, 3 10006, 7, photoshop, 2 10008, 9, Windows XP, 2 The

Re: [GENERAL] Update on tables when the row doesn't change

2005-05-25 Thread Ragnar Hafstað
On Wed, 2005-05-25 at 13:09 +0200, Sebastian Böck wrote: Dawid Kuroczko wrote: Be wary of the NULL values though. :) Either don't use them, add something like 'AND (text1 NEW.text1 OR text1 IS NULL OR NEW.text1 IS NULL)' or something more complicated. :) Thanks for the notice, but

Re: [GENERAL] is in postgres solution

2005-05-16 Thread Ragnar Hafstað
On Mon, 2005-05-16 at 11:43 +0300, Margus Roo wrote: Hello. I have 2 variables type timestamp. Example date1 = 2005-01-01 23:00 and date2 = 2005-05-04 12:00. I want get something like age(date2,date1) but ouput format must by hours::minutes. get the difference in minutes with:

Re: [GENERAL] ORDER BY options (how to order data as AAA, aaa,

2005-05-10 Thread Ragnar Hafstað
On Tue, 2005-05-10 at 11:41 +0200, Julian Legeny wrote: ... But I would like to sort all data as following: NAME --- AAA aaa BBB bbb CCC ccc How can I write sql command (or set up ORDER BY options) for selecting that? how about ORDER BY lower(NAME),NAME

Re: [GENERAL] backup compress...blobs/insert commands/verbose

2005-05-09 Thread Ragnar Hafstað
[note: it is better to create a new thread than to hijack an unrelated one] On Mon, 2005-05-09 at 18:45 +0200, Zlatko Matic wrote: Can someone explain me the following options while using pgAdimn III for backup: my guess is... blobs include blobs in backup. blobs are not included by

Re: [GENERAL] [INTERFACES] calculated identity field in views,

2005-05-04 Thread Ragnar Hafstað
On Wed, 2005-05-04 at 09:01 -0700, Jeff Eckermann wrote: If I understand right, oids are globally unique within your database. I am affraid not gnari ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] does database shut down cleanly when WAL device

2005-05-03 Thread Ragnar Hafstað
On Tue, 2005-05-03 at 10:30 -0400, Brandon Craig Rhodes wrote: theories: a) Putting the WAL on a separate device from the database tables not only increases efficiency, but reliability as well - because as long as one keeps a database backup and a WAL history that goes

Re: [GENERAL] Date addition/subtraction

2005-05-03 Thread Ragnar Hafstað
On Tue, 2005-05-03 at 19:32 +0200, Craig Bryden wrote: How in postgres can I do date/time subtraction or addition. e.g. If I want to get today's date - 30 days? or current_timestamp - 1 hour? easier than you think select current_timestamp - interval '1 hour'; select current_date -interval

Re: [GENERAL] Sorting by constant values

2005-05-03 Thread Ragnar Hafstað
On Tue, 2005-05-03 at 13:29 -0400, Robert Fitzpatrick wrote: I have a column that I want to sort by certain values. The values are Unit, Exterior and Common. I want all the records with Unit first, Common second and Exterior last in the sort order. These are the only 3 possible values, is

Re: [GENERAL] Unique constraint violation on serial column

2005-04-11 Thread Ragnar Hafstað
On Mon, 2005-04-11 at 11:03 -0700, Bill Chandler wrote: ERROR: duplicate key violates unique constraint event_tbl_evt_id_key EVENT_TBL evt_id bigserial, unique d1 numeric(13) obj_id numeric(6) d2 numeric(13) val varchar(22) correction

Re: [GENERAL] very slow after a while...

2005-04-06 Thread Ragnar Hafstað
On Wed, 2005-04-06 at 18:18 +0300, Costin Manda wrote: The script does the following thing: 1. read the count of rows in two tables from the mssql database 2. read the count of rows of the 'mirror' tables in postgres these are tables that get updated rarely and have a maximum of 10

Re: [GENERAL] Time

2005-04-04 Thread Ragnar Hafstað
On Mon, 2005-04-04 at 13:49 +0100, Rob Kirkbride wrote: Hi, I'm trying to fetch out the epoch value of a time, the data type is 'timestamp with time zone'. When I do select extract(epoch from time) it returns a fractional part as well. Am I doing this the correct way? Is the fractional

Re: [GENERAL] not able to connect to Database

2005-03-31 Thread Ragnar Hafstað
On Thu, 2005-03-31 at 16:10 +0530, Nageshwar Rao wrote: When I do psql test (database name) it says database test does not exists. But with pgAdminIII utility I get to see the database test and able to create tables ,insert the data etc. Why is this? maybe the existing data base is

Re: [GENERAL] Views!

2005-03-29 Thread Ragnar Hafstað
On Tue, 2005-03-29 at 11:48 -0500, Hrishikesh Deshmukh wrote: [rearranged] On Tue, 29 Mar 2005 09:01:24 -0500, Sean Davis [EMAIL PROTECTED] wrote: On Mar 29, 2005, at 8:27 AM, Hrishikesh Deshmukh wrote: I have 254 tables, i want to subset it in 237 and 17 tables?! Is creating

Re: [GENERAL] Perl and AutoCommit

2005-03-27 Thread Ragnar Hafstað
On Sun, 2005-03-27 at 00:31 -0500, Madison Kelly wrote: What I thought would work was: $DB-begin_work() || die... # a lot of transactions $DB-commit() || die... maybe a more complete testcase would be in order. [EMAIL PROTECTED]:~/test $ cat trans.pl use DBI; our $dbh =

Re: [GENERAL] sort array optimisation in pl/perl

2005-03-25 Thread Ragnar Hafstað
On Fri, 2005-03-25 at 15:29 +0100, GIROIRE Nicolas (COFRAMI) wrote: [re-arranged] [mailto:[EMAIL PROTECTED] la part de Ragnar Hafstað On Thu, 2005-03-24 at 15:49 +0100, GIROIRE Nicolas (COFRAMI) wrote: I create an array which is result of query on postgresql database and then I

Re: [GENERAL] sort array optimisation in pl/perl

2005-03-24 Thread Ragnar Hafstað
On Thu, 2005-03-24 at 15:49 +0100, GIROIRE Nicolas (COFRAMI) wrote: I create an array which is result of query on postgresql database and then I want to sort rows in a particular way (impossible by query on database). can you give us more details on this particular sort order? My solution

Re: [GENERAL] Question insert data

2005-03-19 Thread Ragnar Hafstað
On Sat, 2005-03-19 at 18:36 +0100, [EMAIL PROTECTED] wrote: 2. I've create a table based on from the master. I copied a fraction from the master into the new table using a where clause (insert into ... select * from ... where a = b . The number of records copied is about 2553. Issueing the

Re: [GENERAL] plpython function problem workaround

2005-03-15 Thread Ragnar Hafstað
On Tue, 2005-03-15 at 07:33 -0600, David wrote: [about the line-termination problem in plpython] I'd like to insert one note here. While I'm not particularly familiar with either perl or python, when I encountered the referred-to thread regarding Windows/Unix newline incompatibilities in

Re: [GENERAL] pg/plsql question

2005-03-15 Thread Ragnar Hafstað
On Tue, 2005-03-15 at 18:18 +0100, Fred Blaise wrote: While I have accomplished what I needed with the pgedit script given by John, I am still curious as to why mine is not working... Here is the latest version: /* */ create or replace function fred_on_all() RETURNS integer AS ' declare

Re: [GENERAL] Massive performance differences

2005-03-15 Thread Ragnar Hafstað
On Tue, 2005-03-15 at 18:10 +0100, Andreas Hartmann wrote: explain analyze select * from veranstaltung_original order by semester; Sort (cost=3054.08..3067.74 rows=5467 width=223) (actual time=2568.10..2573.02 rows=5467 loops=1) Sort Key: semester - Seq Scan on

Re: [GENERAL] sql question

2005-03-14 Thread Ragnar Hafstað
On Sun, 2005-03-13 at 23:13 -0600, George Essig wrote: On Fri, 11 Mar 2005 13:26:07 +0100, Steven Verhoeven [EMAIL PROTECTED] wrote: [snip problem] select id, fref as ref from my_table union select id, mref as ref from my_table; union ALL (see other replies) gnari

Re: [GENERAL] Convert Cursor to array

2005-03-14 Thread Ragnar Hafstað
On Mon, 2005-03-14 at 10:44 +0100, FERREIRA William (COFRAMI) wrote: so we choice to use a different solution which consist on using the index of a chapter and its evolution. if we have this data : chapter_id | evolution | index 1 | 0 | 1 2 | 0 | 2

Re: [GENERAL] Problem with special character

2005-03-14 Thread Ragnar Hafstað
On Mon, 2005-03-14 at 16:32 -0500, David Gagnon wrote: Hi, I really have a problem with a production environment (RH 9, Postgresql 7.4). When I deploy on the production env the same stored procedure with the same data (different OS and postgresql instance) the stored procedure crash. I

Re: [GENERAL] Problem with special character

2005-03-14 Thread Ragnar Hafstað
On Mon, 2005-03-14 at 19:13 -0500, David Gagnon wrote: I did tried to update the stored-procedure via PgadminIII and it worked. The problem seems to be JDBC driver .. But all works well on my TOMCA/POSTGRESL/WINDOWS platform. I think it's something in the database setting .. is there

Re: [GENERAL] General query optimization howto

2005-03-13 Thread Ragnar Hafstað
On Sun, 2005-03-13 at 02:34 +0100, Miroslav ulc wrote: is there on the net any general howto on SQL query optimizations? We have recently moved our project from MySQL to PostgreSQL and are having problem with one of our queries. The EXPLAIN command is surely useful but I don't know how to

Re: [JDBC] [GENERAL] MS Access to PostgreSQL

2005-03-12 Thread Ragnar Hafstað
On Fri, 2005-03-11 at 17:52 +, Brian Gunning wrote: [rearranged quoting] From: [EMAIL PROTECTED] --- William Shatner [EMAIL PROTECTED] wrote: I have recently migrated from MS Access to PostgreSQL.Previously I had a SQL command ResultSet aGroupResultSet =

Re: [GENERAL] Checking for schedule conflicts

2005-03-12 Thread Ragnar Hafstað
On Sat, 2005-03-12 at 00:13 -0800, Benjamin Smith wrote: Given the tables defined below, what's the easiest way to check for schedule conflicts? So far, the only way I've come up with is to create a huge, multi-dimensional array in PHP, with a data element for every minute of all time

Re: [GENERAL] Pgsql dynamic statements and null values

2005-03-09 Thread Ragnar Hafstað
On Tue, 2005-03-08 at 16:30 -0600, Guy Rouillier wrote: We use a dynamic statement in a pgsql stored function to insert rows into a table determined at run time. After much debugging, I've discovered that a null incoming argument will cause the dynamic statement to evaluate to null. The

Re: [GENERAL] IDENT Authentication

2005-03-04 Thread Ragnar Hafstað
On Fri, 2005-03-04 at 19:59 -0500, David A. Cobb wrote: I've newly transitioned from Windoze to Debian Linux. And, of course, I'm installing things left and right. I had pgsql up and running, then I had to do a lot of tearing out and reinstalling other stuff. Now, when I try to connect

Re: [GENERAL] sql join question

2005-03-01 Thread Ragnar Hafstað
On Tue, 2005-03-01 at 13:42 -0800, Scott Frankel wrote: [snip problem] Task: find all color names in each of palette1's tones. Can this be done in a single SQL statement? [snip table examples] looks like a job for NATURAL JOIN test=# select color_name from palettes

Re: [GENERAL] sql join question

2005-03-01 Thread Ragnar Hafstað
On Tue, 2005-03-01 at 16:51 -0800, Scott Frankel wrote: Sweet! And not so sweet. The natural join worked beautifully with my test schema; but it failed to yield any rows with my real-world schema. I think I've tracked down why: duplicate column names. i.e.: ... CREATE TABLE

Re: [GENERAL] Referencing created tables fails with message that

2005-02-28 Thread Ragnar Hafstað
On Sun, 2005-02-27 at 18:50 -0500, Tommy Svensson wrote: I have just installed Postgresql and tried it for the first time. One very serious problem I ran into was when actually trying to use created tables. Creating a simple table without any foreign keys works OK, but after creating the

Re: [GENERAL] Problems with pgcrypto and special characters

2005-02-28 Thread Ragnar Hafstað
On Mon, 2005-02-28 at 18:32 +0100, Markus Wollny wrote: To get straight to the point, here's my problem: mypgdb=# select bytea2text(decrypt(encrypt('Tübingen'::bytea, 'mypassphrase'::bytea,'bf'::text),'mypassphrase'::bytea,'bf'::text)) as foo; foo - T\303\274bingen

Re: [GENERAL] DBI and placeholders question

2005-02-14 Thread Ragnar Hafstað
On Mon, 2005-02-14 at 18:41 +, mike wrote: Is it possible to have a placeholder on the left side of a select criteria? yes eg: SELECT CASE WHEN date_part('dow',?::date)=5 this bit is fine THEN CASE WHEN ? = 2 OR ? =3 OR ?=6 OR ?=7 OR ?=8 OR ?=12 THEN '7:00' here the ? is

Re: [GENERAL] Confused by to_char

2005-02-08 Thread Ragnar Hafstað
On Tue, 2005-02-08 at 12:28 +, mike wrote: I am am trying to get a day string from a date using to_char ie: SELECT date1,ti1 ,to1,ti2,to2,adj,ei,eo,to_char('2005-02-07','Day') FROM vw_times_list1 however I get function to_char(unknown, unknown) is not unique test=# select

Re: [GENERAL] postgres session termination

2005-01-31 Thread Ragnar Hafstað
On Sun, 2005-01-30 at 21:24 -0500, Rick Schumeyer wrote: I think this is a common task, but Im not sure how to do it. I want to run a query that can return many records, display them 10 at a time, and be able to go forward/backward in the list. Im not concerned about the list changing after

Re: [GENERAL] postgres session termination

2005-01-31 Thread Ragnar Hafstað
On Mon, 2005-01-31 at 15:38 -0600, Scott Marlowe wrote: On Mon, 2005-01-31 at 09:28, Alban Hertroys wrote: John DeSoi wrote: I think there are much better ways to do this. If the result set is large, the user could be waiting a very long time. Two possibilities are (1) use a cursor

Re: [GENERAL] Prompt User From a pgplsql Function

2005-01-29 Thread Ragnar Hafstað
On Sat, 2005-01-29 at 13:21 -0500, Terry Lee Tucker wrote: [on prompting user in the middle of a transaction] Thanks for the reply, Tom. I just had an idea about writting the answer from the client to a table designed for that purpose. It could have a unique key as the pid and a column for

Re: [GENERAL] Strange results of ORDER BY clause when item begins

2005-01-19 Thread Ragnar Hafstað
On Wed, 2005-01-19 at 11:24 -0800, [EMAIL PROTECTED] wrote: [non-word character being ignored by ORDER BY] ... testdb1= show LC_COLLATE; lc_collate - en_US.UTF-8 (1 row) this is a 'feature' of your en_US locale: bash$ export LC_COLLATE=en_US bash$ (echo usra;echo usrq;echo

Re: [GENERAL] Index optimization ?

2005-01-16 Thread Ragnar Hafstað
On Sun, 2005-01-16 at 16:25 +0100, Bo Lorentsen wrote: [about a volatile function in a where clause not generating index scan] Will the only possible way to fix this be to make a volatile function with a return type (I know this is not possible now, but in theory) ? this has nothing to do

Re: [GENERAL] Index optimization ?

2005-01-16 Thread Ragnar Hafstað
On Sun, 2005-01-16 at 17:45 +0100, Bo Lorentsen wrote: Ragnar Hafstað wrote: when a volatile function is used thus: SELECT * FROM mytable WHERE col=myvolatilefunc(); the planner must call the function once per table row, and assume possibly different return values each time, so an indexscan

Re: [GENERAL] Index optimization ?

2005-01-16 Thread Ragnar Hafstað
On Sun, 2005-01-16 at 14:11 -0500, Tom Lane wrote: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= [EMAIL PROTECTED] writes: On Sun, 2005-01-16 at 17:45 +0100, Bo Lorentsen wrote: Why not use the index scan for every row, is this a limit in the planner ? I think there is something in the planner I don't

Re: [GENERAL] PL/Perl

2005-01-11 Thread Ragnar Hafstað
On Tue, 2005-01-11 at 14:59 +0300, ON.KG wrote: I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at (eval 2) line 11. Does it mean, that in

Re: [GENERAL] need help Connect failure in an applet

2005-01-07 Thread Ragnar Hafstað
On Fri, 2005-01-07 at 13:03 -0500, John Doggett wrote: When I did that, I now get a different error, that the postmaster is refusingthe connection. The solution to this problem is supposed to be adding tcpip_socket = true to the postgresql.conf file and restarting the postgresql

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Ragnar Hafstað
On Thu, 2005-01-06 at 17:57 +0100, Joost Kraaijeveld wrote: Hi Tom, I could give you access to the database itself if needed. But these are the actual tables and view. I hope I will never make any tpo's again to upset you this way. no-one was upset. the point is just that you are more

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Ragnar Hafstað
On Wed, 2005-01-05 at 13:51 -0800, [EMAIL PROTECTED] wrote: I have a small table in which I have a Character(1) field called reengine. The field either has an X or is empty. This field does not have NULL values. There are 27 records in the table, 25 are marked with an 'X' in reengine. I am

Re: [GENERAL] Index on a view??

2005-01-05 Thread Ragnar Hafstað
On Wed, 2005-01-05 at 13:03 -0800, Jeff Davis wrote: On Wed, 2005-01-05 at 13:14 -0700, Michael Fuhr wrote: On Wed, Jan 05, 2005 at 08:15:28PM +0100, Joost Kraaijeveld wrote: [snip] PostgreSQL doesn't have materialized views per se but it does have functionality that can implement

Re: [GENERAL] SELECT WHERE NOT, is not working

2005-01-05 Thread Ragnar Hafstað
On Wed, 2005-01-05 at 22:32 +, Ragnar Hafstað wrote: select count(*) from resource where reengine is NULL 'X'; typo. I meant of course: select count(*) from resource where reengine is NULL; gnari ---(end of broadcast)--- TIP 5: Have you

Re: [GENERAL] Shared Sequences?

2005-01-02 Thread Ragnar Hafstað
On Sun, 2005-01-02 at 16:19 -0500, C. Duncan Hudson wrote: [about databases sharing a sequence] I have 3 instances of the application (each for a different business unit) and I don't want them generating the same numbers for different things. I want the numbers, across

Re: [GENERAL] Multi row sequence?

2004-12-19 Thread Ragnar Hafstað
On Sun, 2004-12-19 at 15:02 +0200, Ciprian Popovici wrote: On Sat, 18 Dec 2004 11:07:37 -0600 Bruno Wolff III [EMAIL PROTECTED] wrote: On Fri, Dec 17, 2004 at 11:10:12 -, Filip Wuytack [EMAIL PROTECTED] wrote: Is it possible to have a sequence (as a multirow prim key), where

Re: [GENERAL] Multi row sequence?

2004-12-19 Thread Ragnar Hafstað
On Sun, 2004-12-19 at 22:43 +0200, Ciprian Popovici wrote: On Sun, 19 Dec 2004 13:51:39 + Ragnar Hafstað [EMAIL PROTECTED] wrote: On Sun, 2004-12-19 at 15:02 +0200, Ciprian Popovici wrote: On Sat, 18 Dec 2004 11:07:37 -0600 Bruno Wolff III [EMAIL PROTECTED] wrote: On Fri, Dec 17

Re: [GENERAL] pgplsql SELECT INTO ... FOR UPDATE

2004-12-15 Thread Ragnar Hafstað
On Wed, 2004-12-15 at 01:38 -0800, Eric Brown wrote: __ I'm trying to write a stored procedure in plpgsql that selects a row and possibly increments one of its fields. I thought I would do SELECT INTO my_record * FROM

Re: [GENERAL] ERROR: relation table does not exist - HELP

2004-12-11 Thread Ragnar Hafstað
On Sat, 2004-12-11 at 01:54 -0200, itamar wrote: when I run select * from table I get this error. ERROR: relation table does not exist The table name is is folded to lowercase, unless it is in quotes. so if the name of the table is TABLE, you need select * from TABLE Is this your