Re: [GENERAL] Cast record as text

2007-02-14 Thread A. Kretschmer
am Wed, dem 14.02.2007, um 16:38:27 +0200 mailte [EMAIL PROTECTED] folgendes: > Hi, > > I'm trying to build an audit system for several tables. My idea was to use > triggers and plpgsql to record changes made to "important tables" to a > special audit table. My problem is that I don't want to cre

Re: [GENERAL] Cast record as text

2007-02-14 Thread A. Kretschmer
am Wed, dem 14.02.2007, um 22:37:36 +0200 mailte Mikko Partio folgendes: > > Why do you want to reinvent the wheel? > > > > http://pgfoundry.org/projects/tablelog/ > > > > > > But it use a separate log-table per table. > > > > > > Andreas > > My original idea was to log changes from different tab

Re: [GENERAL] Installing on weendoze vista.

2007-02-14 Thread A. Kretschmer
am Thu, dem 15.02.2007, um 8:11:06 +0900 mailte Paul Lambert folgendes: > Has anyone had any success installing on weendoze vista? > > Any install I try gets as far as the service user details, if I ask it > to create a user it fails, if I specify an existing user account it > complains about

Re: [GENERAL] Problem writing sql statement....

2007-02-16 Thread A. Kretschmer
am Thu, dem 15.02.2007, um 22:13:31 +0100 mailte Bjørn T Johansen folgendes: > I have a table that I want to find rows that have the same value in two > fields, e.g. all rows that have the same date and also the > same productionid... > How do I write such an sql statement? I'm not sure if I un

Re: [GENERAL] Esay question, about the numeric format

2007-02-22 Thread A. Kretschmer
am Thu, dem 22.02.2007, um 12:20:12 +0100 mailte Rafa Comino folgendes: > Hi every body > I have this query > SELECT 20.00::numeric(38,2) > and postgre gives me 20, i need that postgre gives me 20.00 Works for me: (version 8.1) test=*# SELECT 20.00::numeric(38,2); numeric - 20.00 (1

Re: [GENERAL] Installing PGSQL Client

2007-02-22 Thread A. Kretschmer
am Thu, dem 22.02.2007, um 23:23:42 -0800 mailte RPK folgendes: > > I have installed PGSQL on server. How to install PGSQL client to connect to > the PGSQL database server. Depends on the operating system and distribution. For Debian for instance: apt-get install postgresql-client-8.1 Andreas

Re: [GENERAL] M$ Access "crosstab" query tab PostgreSQL equivalent

2007-02-24 Thread A. Kretschmer
am Sat, dem 24.02.2007, um 12:12:00 -0600 mailte Seb folgendes: > Hi, > > I'm unable to find how to construct a query like the one mentioned in the > Subject. The Access query looks like this: Take a look into contrib, there are a tablefunc.sql - file with functions like crosstabN(). > I've a

Re: [GENERAL] Inserting a new column in between.

2007-02-24 Thread A. Kretschmer
am Sat, dem 24.02.2007, um 23:08:05 -0800 mailte RPK folgendes: > > I think pgsql front-end needs this facility in future. No. You can specify the column-order in the SELECT or INSERT - command. And you can do it with regular SQL. PostgreSQL possesses transactions. > > > Joshua D. Drake wrote:

Re: [GENERAL] how to sort an array and remove duplicate in plpgsql

2007-02-26 Thread A. Kretschmer
am Mon, dem 26.02.2007, um 9:15:52 -0500 mailte David Gagnon folgendes: > Hi all, > > I?m messing up with this problem for a while and I searched the web without > success. I have an array of timestamp and I needed sorted and I need to > remove > duplicate value. The Select statement offers

Re: [GENERAL] Querying all months even if don't exist

2007-02-26 Thread A. Kretschmer
am Mon, dem 26.02.2007, um 10:10:45 -0500 mailte Robert Fitzpatrick folgendes: > I have a query that pulls totals for the month and from there I am > building a crosstab to show all months. My dilemma is that sometimes > there is no data for a month and the crosstab becomes skewed. I made a > tabl

Re: [GENERAL] psql : password on Win32

2007-02-26 Thread A. Kretschmer
am Mon, dem 26.02.2007, um 19:34:25 +0100 mailte Fabio D'Ovidio folgendes: > I have used pgpass.conf file with the syntax : > > localhost:5432:mydb:postgres:password > > and it doesn't work. Wrong syntax. Change ':' to '\t' or other whitespace. Andreas -- Andreas Kretschmer Kontakt: Heynitz

Re: [GENERAL] pg_dump and restore problem with function as DEFAULT-Constraint

2007-02-27 Thread A. Kretschmer
am Tue, dem 27.02.2007, um 17:44:06 +0100 mailte Markus Schulz folgendes: > Hello, > > i have some trouble with dumping and restoring a database with > postgresql 7.4.7-6sarge4 (debian sarge). Is the new database also 7.4? Why not 8.1 oder 8.2? > > Some tables have plpgsql-functions as DEFAUL

Re: [GENERAL] creating a function with a variable table name

2007-03-01 Thread A. Kretschmer
am Thu, dem 01.03.2007, um 11:17:46 -0500 mailte George Nychis folgendes: > Hey all, > > I'm trying to create a function in which the table a query is run on is > variable, but I guess this is not as easy as I thought. > > BEGIN > dp=> CREATE FUNCTION stats_addr_dst(date,text) > ... > dp'>

Re: [GENERAL] creating a function with a variable table name

2007-03-01 Thread A. Kretschmer
am Thu, dem 01.03.2007, um 11:47:02 -0500 mailte George Nychis folgendes: > do I need to use PREPARE with it also? No. > > A. Kretschmer wrote: > >am Thu, dem 01.03.2007, um 11:17:46 -0500 mailte George Nychis folgendes: > >>Hey all, Please no top-posting with f

Re: [GENERAL] get username of user calling function?

2007-03-01 Thread A. Kretschmer
am Thu, dem 01.03.2007, um 11:40:11 -0500 mailte George Nychis folgendes: > Hi, > > Is it possible to get the username of the user calling a function? You can use the current_user - variable. Select current_user; Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/714163

Re: [GENERAL] Query timing

2007-03-04 Thread A. Kretschmer
am Mon, dem 05.03.2007, um 15:28:29 +1100 mailte Naz Gassiep folgendes: > Using EXPLAIN ANALYZE I can get the execution time of a query. Is there > a command I can use to get the execution time without the planning Within psql, the command-line-interface, you can use \timing to switch on/off re

Re: [GENERAL] Does it has a way to compact the database size?

2007-03-06 Thread A. Kretschmer
am Tue, dem 06.03.2007, um 15:28:01 +0700 mailte Premsun Choltanwanich folgendes: > Dear All, > > I use PostgreSQL 8.0.3 for store my data started on Sep'06. Today, I > use database_size('name') function for checking my database size and > found that it's about 1209715345. > ... > Any Idea? Y

Re: [GENERAL] Statement logging

2007-03-14 Thread A. Kretschmer
am Wed, dem 14.03.2007, um 9:57:41 +0100 mailte Hannes Dorbath folgendes: > Is there any way to enable statement logging at runtime without a restart? > > If not I think that would be a nice feature, as one sometimes need to > debug applications that are already in production.. set log_stateme

Re: [GENERAL] Statement logging

2007-03-14 Thread A. Kretschmer
am Wed, dem 14.03.2007, um 10:10:02 +0100 mailte hubert depesz lubaczewski folgendes: > On 3/14/07, Hannes Dorbath <[EMAIL PROTECTED]> wrote: > >Is there any way to enable statement logging at runtime without a restart? > >If not I think that would be a nice feature, as one sometimes need to > >d

Re: [GENERAL] PgSql on Vista?

2007-03-15 Thread A. Kretschmer
am Wed, dem 14.03.2007, um 1:24:01 -0700 mailte Arkan folgendes: > Hi all, > > have anybody installed PgSQL on Windows Vista? I tried yesterday but I > fail... on XP and linux i've installed pgsql much times but on > vista... nothing to do! Version in 8.2.3 with the installer. > > If I install

Re: [GENERAL] Log Query and Execution time

2007-03-26 Thread A. Kretschmer
am Mon, dem 26.03.2007, um 15:45:07 +0700 mailte Luki Rustianto folgendes: > Hi All, > > Is there is a way to log every SQL query on potgresql server and also > their execution time? Yes. log_statement = 'all' log_min_duration_statement = 0 (postgresql.conf) Andreas -- Andreas Kretschmer Ko

Re: [GENERAL] how to know a table size ?

2007-03-28 Thread A. Kretschmer
am Wed, dem 28.03.2007, um 19:02:40 +0200 mailte Alain Roger folgendes: > Hi, > > I would like display in my PHP application the size of each table. > So, how can i get the table size (for example in Mb) ? There are some functions, read: http://www.postgresql.org/docs/current/interactive/functio

Re: [GENERAL] COPY command details

2007-03-29 Thread A. Kretschmer
am Thu, dem 29.03.2007, um 0:13:09 -0700 mailte Benjamin Arai folgendes: > Hi, > > If I have a PostgreSQL table with records and logical indexes already > created, if I use COPY to load additional data, does the COPY update > the indexes during, after, or not at all? after, i think. test=#

Re: [GENERAL] COPY command details

2007-03-29 Thread A. Kretschmer
am Thu, dem 29.03.2007, um 10:02:49 -0700 mailte Benjamin Arai folgendes: > So, is there a way to defer the index updating until a later period > of time. More specifically, I would like to do several COPIES to a > running database, then afterward force a update on the index via a > vacuum

Re: [GENERAL] PlPg/SQL

2007-04-02 Thread A. Kretschmer
am Sat, dem 31.03.2007, um 15:40:56 -0700 mailte MaDog folgendes: > Hi! > > How can i return one more row form a pgpl/sql function? You can use a set-of-record - function for this: http://www.postgresql.org/docs/current/static/xfunc-sql.html#XFUNC-SQL-TABLE-FUNCTIONS or http://www.postgresql.

Re: [GENERAL] inserting multiple values in version 8.1.5

2007-04-03 Thread A. Kretschmer
am Tue, dem 03.04.2007, um 7:19:15 -0700 mailte [EMAIL PROTECTED] folgendes: > I need to do like 1000 inserts periodically from a web app. Is it better to do > 1000 inserts or 1 insert with the all 1000 rows? Is using copy command faster > than inserts? You can do the massive Inserts within one

Re: [GENERAL] Granting permissions

2007-04-04 Thread A. Kretschmer
am Wed, dem 04.04.2007, um 22:23:20 -0700 mailte Postgres User folgendes: > Is there a way to grant INSERT and UPDATE permissions on all the > tables in a database? I don't want to type-in every table name... http://people.planetpostgresql.org/greg/index.php?/archives/38-Scripting-with-psql.htm

Re: [GENERAL] Adding multiple column in alter statement?

2007-04-04 Thread A. Kretschmer
am Thu, dem 05.04.2007, um 6:58:01 +0100 mailte Ashish Karalkar folgendes: > Hello All, > I want to add multiple column to a table using single alter statemet, > someting like this: > > alter table admin_session add column accounting_session varchar(1) not null > default '0',accounting_active

Re: [GENERAL] Granting permissions

2007-04-05 Thread A. Kretschmer
am Thu, dem 05.04.2007, um 7:59:11 +0100 mailte Ashish Karalkar folgendes: > > Even More is there any way to grant permission to a user on another database > ?? What do you want to do? Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-

Re: [GENERAL] PlPg/SQL mulit-array as a parameter?

2007-04-10 Thread A. Kretschmer
am Sat, dem 07.04.2007, um 6:27:27 -0700 mailte Simon István folgendes: > How can i use multi-array parameter in PlPg/SQL? > > This array want to put in parameter. > [[0, 1, 3, 0, 3, 4], [7, 12, 1, 9, 1, 2], [12, 24, 20, 42, 43, 44], > [24, 103, 65, 113, 72, 25], [179, 357, 335, 348, 309, 138],

Re: [GENERAL] Is this a bug? Sequences and rules

2007-04-10 Thread A. Kretschmer
am Tue, dem 10.04.2007, um 22:49:27 -0700 mailte Chris Travers folgendes: > Hi; > > I noticed that rules were not behaving properly. I created a test case, > and it looks like the sequence is getting double-incrimented. Is this > the way this is supposed to work? > > I know triggers would be

Re: [GENERAL] Login to Postgres 8.2 via Cygwin hangs

2007-04-18 Thread A. Kretschmer
am Wed, dem 18.04.2007, um 23:25:07 -0400 mailte Sergei Dubov folgendes: > Hi guys, > > I just installed the latest release of Postgres (8.2 native version) on > Win XP Pro). When I try to run psql through Cygwin, I cannot get to the I'm not familiar with this crappy os, but since version 8.0

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

2007-04-18 Thread A. Kretschmer
am Wed, dem 18.04.2007, um 21:59:35 -0700 mailte chrisj folgendes: > > I would like to do a selective export of a number of tables from a large > database to import into a smaller (test) DB. > > I know about: psql dbname -tc "select * from tableX where whatever" > > tableX.dat > > but unless I

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] Modify existing index

2007-04-21 Thread A. Kretschmer
am Sat, dem 21.04.2007, um 0:20:45 -0700 mailte RPK folgendes: > > How to see the details of indexes being used by a table? If I want to drop an Within psql, type '\d '. > index, how can I do that? DROP , perhaps with option CASCADE. Please read our documentation... Andreas -- Andreas Kr

Re: [GENERAL] understanding output from Explain

2007-04-22 Thread A. Kretschmer
am Sun, dem 22.04.2007, um 9:43:32 -0400 mailte Tom Allison folgendes: > "Seq Scan on" - is this just a FULL TABLE scan? Yes. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.

Re: [GENERAL] Postgresql Help

2007-04-22 Thread A. Kretschmer
am Mon, dem 23.04.2007, um 10:51:31 +0530 mailte Mageshwaran folgendes: > Hi , > > I am new to postgresql, I have been assigned a task of upgrading > postgresql to higher version. > In our company we are using 7.1.1,7.1.3,7.4.5 versions of postgresql, > can you please tell me which is the stable

Re: [GENERAL] [pgsql] inherits and foreign key problem

2007-04-23 Thread A. Kretschmer
am Tue, dem 24.04.2007, um 10:30:15 +0800 mailte Magicloud Magiclouds folgendes: > Dear all, >I have some tables like below, and now i have one record for each > in simple_texts, simple_directories and side_types. Now I want to > insert one record into sides (from simple_directory to simple_t

Re: [GENERAL] query from a list of ids

2007-04-24 Thread A. Kretschmer
am Tue, dem 24.04.2007, um 14:19:05 -0700 mailte finecur folgendes: > Hi, > > Here is my first table: > > Table1 > > name| ids > - > Peter| 2, 3, 4, 5 > Jack| 100, 34, 3 > > Both name and ids are in text format. > > Here is my second table > > Table2 > > id | Flag |

Re: [GENERAL] reasonable limit to number of schemas in a database?

2007-04-24 Thread A. Kretschmer
am Wed, dem 25.04.2007, um 1:14:15 -0400 mailte Tom Lane folgendes: > Ben <[EMAIL PROTECTED]> writes: > > I'm considering re-architecting a database to make use of many, many > > schemas over time, it would probably grow to be on the order of 3,000 > > or so, with each schema holding ~100 t

Re: [GENERAL] Kill a Long Running Query

2007-04-25 Thread A. Kretschmer
am Wed, dem 25.04.2007, um 20:03:37 +0530 mailte Mageshwaran folgendes: > Hi , > Any body tell me how to kill a long running query in postgresql, is > there any statement to kill a query, and also tell me how to log slow > queries to a log file. pg_cancel_backend(pid int) to kill. You need to k

Re: [GENERAL] FOREIGN KEY CONSTRAINT AND INHERITANCE

2007-04-25 Thread A. Kretschmer
am Wed, dem 25.04.2007, um 19:25:46 +0400 mailte Sergey Karin folgendes: > vka7=# insert into style_type_object values(1, 2, false, 0, 0); > ERROR: insert or update on table "style_type_object" violates foreign key > constraint "fk_id_style" > DETAIL: Key (id_style)=(2) is not present in table "

Re: [GENERAL] Business days

2007-04-25 Thread A. Kretschmer
am Wed, dem 25.04.2007, um 21:01:13 -0400 mailte Eddy D. Sanchez folgendes: > Hello... > I need to get the a total number of business days (from monday to > friday) between two dates. > Someone can help me please. For instance the number of business days between 2007-04-01 and 2007-04-30: sele

Re: [GENERAL] Business days

2007-04-27 Thread A. Kretschmer
am Fri, dem 27.04.2007, um 8:18:55 +0100 mailte Peter Childs folgendes: > >Sure, that's an alternative, but it seems a bit too much reinventing an > >already existing wheel. I was amused to see the script had the ill-fated > >Lee-Jackson-King day in it. Ideally, we'd want a Postgres table that >

Re: [GENERAL] Selecting from a function(x,y) returning a row-type(sum, prod)

2007-04-30 Thread A. Kretschmer
am Mon, dem 30.04.2007, um 15:45:18 +0200 mailte Heiko Klein folgendes: > Hi, > > I'm trying to select data from a table, converting two values and return > all four. Maybe this is best explained with an example: > > The function from the documentation on pl/pgsql: > > CREATE FUNCTION sum_n_pr

Re: [GENERAL] CHECK() Constraint on Column Using Lookup Table

2007-05-01 Thread A. Kretschmer
am Tue, dem 01.05.2007, um 10:41:44 -0700 mailte Rich Shepard folgendes: > I've seen the syntax for using a lookup table in a CHECK() constraint, but > I cannot find a reference to it. It's not in Section 5.3.1 of the 8.2 docs. > > Specifically, I want to reference a table of ISO 2-letter cod

Re: [GENERAL] Date Math

2007-05-07 Thread A. Kretschmer
am Mon, dem 07.05.2007, um 9:43:50 -0700 mailte Rich Shepard folgendes: > From table (Permits) I want to identify those which expire within a > specified time from today. For example: > > SELECT permit_nbr, title, date_issued, term, > process_time from Permits > WHERE

Re: [GENERAL] Postgre Sql 7.3 connection problem

2007-05-07 Thread A. Kretschmer
am Mon, dem 07.05.2007, um 0:39:43 -0700 mailte nij es folgendes: > sir, > > I am using postgresql 7.3 in Redhat Linux.Windows XP is my client. I want to > communicate pgsql without a specific ip rangeI.I want to accept all ip address > in postgresql 7.3. How can i comunicate. Please help me to

Re: [GENERAL] Postgre Sql 7.3 connection problem

2007-05-07 Thread A. Kretschmer
am Mon, dem 07.05.2007, um 17:15:04 -0300 mailte Osvaldo Rosario Kussama folgendes: > >First, 7.3 are out of date... > > > >You should check if your PG-Server listening on TCP/IP. Take a look into > >your postgresql.conf, you need an entry like 'listen_addresses = ...'. > > Valid only in 8.+ ver

Re: [GENERAL] SQL Transaction related

2007-05-09 Thread A. Kretschmer
am Thu, dem 10.05.2007, um 2:24:40 -0400 mailte Harpreet Dhaliwal folgendes: > Hi, > > I have a transaction like following: > > BEGIN > > INSERT INTO tbl_xyz VALUES (val1, val2); > > SELECT INTO wid MAX(val1) FROM tbl_xyz; > > END; > > My question is in the SELECT INTO statement

Re: [GENERAL] Plpgsql function and variable substitute

2007-05-16 Thread A. Kretschmer
am Wed, dem 16.05.2007, um 15:11:17 +0200 mailte Ji?í N?mec folgendes: > Hello, > > I have searched the Internet for an answer but nothing works for me. > > There is a plpgsql function which is used in a trigger. I need to > substitute a value "7" for "lifetime" (integer) SELECTed in a previous

Re: [GENERAL] Question

2005-11-29 Thread A. Kretschmer
am 29.11.2005, um 1:25:37 -0800 mailte Peter Futaro folgendes: > Can you please provide me the command behind "\d" or perhaps tell > me what attributes do you use to build that "\d" report ? Start psql with -E. Now you can see the sql-commands for \d and other commands like this. HTH, An

Re: [GENERAL] date/time function

2005-12-01 Thread A. Kretschmer
am 01.12.2005, um 11:07:59 +0200 mailte Sterpu Victor folgendes: > I need a function that will transform from the format '2002-09-08 05:29:41' > to seconds since 1970. scholl=# select now(); now --- 2005-12-01 10:18:47.554236+01 (1 row) scholl=# select

Re: [GENERAL] error in creating database

2005-12-06 Thread A. Kretschmer
am 06.12.2005, um 17:56:20 +0530 mailte Karthik.S folgendes: > Dear all, > > I am using postgres version: 7.1.3 in Red hat linux : 7.2. Uuhhh, 7.1 is out of lifetime. You should update! > > I am having a script (uses psql) which drops and creates a database by > logging > into 'temp

Re: [GENERAL] Delete Question

2005-12-06 Thread A. Kretschmer
am 07.12.2005, um 18:21:25 +1100 mailte Alex folgendes: > Hi, > > I have a table where I store changes made to an order. The looks like > ProdID, ChangeDate, Change1, Change2, ... etc. > Some ProdIDs have multiple records. > > Is there an easy way to delete all records of a ProdID except the mos

Re: [GENERAL] Delete Question

2005-12-07 Thread A. Kretschmer
am 07.12.2005, um 8:54:56 +0100 mailte A.j. Langereis folgendes: > Postgresql supports records in the where clause i.e. you can compare > multiple columns simultaneously: > > > test=# delete from change where id || ':' || datum not in (select id || > ':' || max(datum) from change group by id ord

Re: [GENERAL] MySQL dump

2005-12-07 Thread A. Kretschmer
am 07.12.2005, um 10:53:27 +0300 mailte go KEY802207 folgendes: > Hi All! > > Tell me please - is there any script for conversion MySQL dump > file into PostgreSQL ? http://techdocs.postgresql.org/#convertfrom HTH, Andreas -- Andreas Kretschmer(Kontakt: siehe Header) Heynitz: 035242/47

Re: [GENERAL] Problem: libpq, network traffic, memory usage

2005-12-07 Thread A. Kretschmer
am 07.12.2005, um 18:01:51 +0100 mailte Alexander Scholz folgendes: > Dear NG, > > I have a serious performance flaw, when using postgresql 8.1 (other > versions haven't been tested) with libpq. When executing a > > select * from "xyz" 1) > > and "xyz" contains 300'000 records, it takes

Re: [GENERAL] how to check if a database exists programatically

2005-12-08 Thread A. Kretschmer
am 08.12.2005, um 17:25:10 +0530 mailte surabhi.ahuja folgendes: > i have to write a shell script in which i have to check if the database > "abc" exists or not > > how should i do it ? some select query > > select * from ??? where database_name = 'abc'; You can parse the output from 'psql

Re: [GENERAL] pg_dump problems

2005-12-09 Thread A. Kretschmer
am 09.12.2005, um 12:21:25 +0100 mailte [EMAIL PROTECTED] folgendes: > Hi ! > > We have an old web service with a pgsql database (in Suse Linux). This > database created by another programmer who no accessible now. > > We want to dump this database to get data from it. But I have no passwords.

Re: [GENERAL] postgreSQL 8.0.4 - Windows driver

2005-12-12 Thread A. Kretschmer
am 12.12.2005, um 16:55:21 +0530 mailte Prakash Nair folgendes: > Hello, >   > I have postgreSQL 8.0.4 running on a RHES machine. I would > like to connect to the database from my Windows verson of Crystal Reports. > >   > Does anyone knows, which driver i need to install in my > Windows machi

Re: [GENERAL] is this a bug or I am blind?

2005-12-15 Thread A. Kretschmer
am 15.12.2005, um 14:12:23 +0100 mailte Mage folgendes: > online=# select * from common_logins where username = 'potyty'; > uid | username | password | lastlogin | status | usertype | loginnum > -+--+--+---++--+-- > (0 rows) > > online=# select

Re: [GENERAL] sequences in transaction blocks

2005-12-18 Thread A. Kretschmer
am 19.12.2005, um 9:39:11 - mailte Marian Naghen folgendes: > I want to insert records inside a transaction block (BEGIN - > COMMIT/ROLLBACK). If the transaction fails, > the sequence do not rollback and retain the new value. > > This is the default behavior of sequences ? Yes. HTH, An

Re: [GENERAL] Newbie Question: FAQ for database optimization?

2005-12-20 Thread A. Kretschmer
am 20.12.2005, um 22:21:54 +0100 mailte Alexander Scholz folgendes: > Hi, > > is there a newbie's FAQ / book / link for "howto optimize databases with > PostgreSQL"? 07:12 < rtfm_please> For information about tuning 07:12 < rtfm_please> see http://www.powerpostgresql.com 07:12 < rtfm_please> or

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 12:37:51 +0100 mailte SunWuKung folgendes: > When storing data in an array, like this > > idarray > 1,{1,2} > 2,{10,20} > 3,{100,200} Forever 2 Elements in the array? Then: test=# select * from t1; id |foo +--- 1 | {1,2} 2 | {10,20} 3 | {

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 13:24:54 +0100 mailte SunWuKung folgendes: > Unfortunately the number of elements in the array is not known > beforehand. The dimension of the array is always 1, but the number of > elements changes from 50-500. Okay. test=# select * from t1; id | foo +

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 16:42:08 +0200 mailte Volkan YAZICI folgendes: > Hi, > > Here's a modified version of A. Kretschmer's answer. This one checks > array_upper() sizes and depending on it, doesn't provide unnecessary > NULL fields. HTH. > > SELECT id, val[s.i] > FROM t7 > LEFT JOIN > (SELECT

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 18:19:12 -0500 mailte Greg Stark folgendes: > Look in the contrib directory, build the intagg module (or if you use debian > install the postgresql-contrib package) and then: > > SELECT id, int_array_enum(val) FROM t7 Cool, it works perfectly. Andreas -- Andreas Kretschmer

Re: [GENERAL] Reordering columns in a table

2006-01-06 Thread A. Kretschmer
am 06.01.2006, um 9:45:53 -0600 mailte John McCawley folgendes: > Is there a way to change the order of columns in a table in Postgres after > it has been created? Back when I used MS SQL Server, it was trivial to go Yes. 'select foo, bar, batz from table', 'select bar, foo, batz from table'

Re: [GENERAL] Autocommit in Fedora 3

2006-01-06 Thread A. Kretschmer
am 05.01.2006, um 15:28:06 -0300 mailte MARCELO_LIMA/[EMAIL PROTECTED] folgendes: > Help me please, > > I need to change autocommit for off in Fedora 3. ,[ change your ~/.psqlrc ] | [EMAIL PROTECTED]:~$ cat ~/.psqlrc | set AUTOCOMMIT off ` HTH, Andreas -- Andreas Kretschmer(Kon

Re: [GENERAL] Autocommit in Fedora 3

2006-01-06 Thread A. Kretschmer
am 06.01.2006, um 17:45:57 +0100 mailte A. Kretschmer folgendes: > am 05.01.2006, um 15:28:06 -0300 mailte MARCELO_LIMA/[EMAIL PROTECTED] > folgendes: > > Help me please, > > > > I need to change autocommit for off in Fedora 3. > > ,[ change your ~/.

Re: [GENERAL] COPY to

2006-01-07 Thread A. Kretschmer
am 07.01.2006, um 14:13:28 -0600 mailte Angshu Kar folgendes: > Hi Pgsql, > > I want to copy the output of a SELECT query onto a text file. I'm trying to > use the COPY command for that as : > > COPY (SELECT ) to 'outfile' Wrong. \o output.txt select ... \o And now you have the result in

Re: [GENERAL] Array as a parameter to stored procedure.

2006-01-10 Thread A. Kretschmer
am 10.01.2006, um 11:19:32 -0500 mailte Sameer Nanda folgendes: > Is it possible to accept an array (or any data structure representing an > ordered set ) as an input parameter in a stored procedure? The > number of elements will vary from call to call. Yes, of course. A simple example: http://a-

Re: [GENERAL] Returning SQL statement

2006-01-12 Thread A. Kretschmer
am 11.01.2006, um 14:57:42 -0800 mailte rlee0001 folgendes: > I want to write a row-level trigger in PL/PGSQL that inserts rows into > an audit log whenever records are UPDATEd for a specific table. In my > audit log I want to record: Why do you want to reivent the wheel? http://pgfoundry.org/pro

Re: [GENERAL] LIMIT + OFFSET

2006-01-17 Thread A. Kretschmer
am 17.01.2006, um 16:43:36 +0100 mailte MG folgendes: > Hello, > > I want to show an overview where you can place 16 data sets. > I use the sql-statement > SELECT F1,F2 FROM testtable limit 16 offset 0 > > To show different pages I vary the value for offset. > > But if I want to stay on a speci

Re: [GENERAL] How to log full substituted queries?

2006-01-18 Thread A. Kretschmer
am 18.01.2006, um 20:47:23 -0800 mailte andrew fabbro folgendes: > I'm trying to debug some queries and have > > log_statement = 'all' > > in my postgresql.conf. When I look in the resultant log file, I see > entries like this: > > INSERT INTO servers ( > hostname, l

Re: [GENERAL] Insert a default timestamp when nothing given

2006-01-19 Thread A. Kretschmer
am 19.01.2006, um 12:55:44 +0100 mailte Martin Pohl folgendes: > > Hi, > > I have to port an application from MS SQL7 to Postgresql (7.4). > > When I have a column with a datetime on MS SQL7 the following is possible: > INSERT INTO mytable (mydate) values (''); wrong date! > > In this ca

Re: [GENERAL] Connected user in a triggerfunction

2006-01-19 Thread A. Kretschmer
am 20.01.2006, um 7:56:38 +0100 mailte Dick Kniep folgendes: > Hi list, > > We are using logging in a database based on triggers and plpgsql functions. > This works OK. However, we want deletes to be recorded too, and there we want > the user who connected to be recorded in the log. So, how ca

Re: [GENERAL] Postgresql/

2006-01-23 Thread A. Kretschmer
am 23.01.2006, um 11:38:28 +0100 mailte Janning Vygen folgendes: > I would like to talk to some professional Postgresql DBA personally > (preferred > in german language). Of course we will pay for it. I don't want to talk to > sells personal, i want to talk to someone who really knows and has l

Re: [GENERAL] Finding missing records

2006-01-27 Thread A. Kretschmer
am 27.01.2006, um 14:59:47 +0100 mailte Stefano B. folgendes: > How can I find the difference between the two tables? > table1 has 1 records > table2 has 9900 records (these records are in table1 as well) > > I'd like to find 100 missing records. > I have try this query > > select f1,f2,f3,

Re: [GENERAL] Accessing an old database from a new OS installation.

2006-01-27 Thread A. Kretschmer
am 27.01.2006, um 14:21:31 + mailte Matthew Henderson folgendes: > Okay, so if I have 7.4 installed and I have the old > harddisk mount under /mnt/hda can I do something > like > > pg_dump /mnt/hda/path_to_old_database > dump.txt No, this is imposible IMHO. You need a PG-Server with this

Re: [HACKERS] [GENERAL] New project launched : PostgreSQL GUI

2006-01-31 Thread A. Kretschmer
am 31.01.2006, um 8:46:44 +0100 mailte Tino Wildenhain folgendes: > Jonah H. Harris schrieb: > >I had to deal with an installer written in python and several in Java... > >IMHO, Java would be a better language for this and you could build off > >some nice OSS installers that already exist (such

Re: [GENERAL] Creating views (Multiple Databases)

2006-02-01 Thread A. Kretschmer
am 01.02.2006, um 23:05:43 -0800 mailte Benjamin Arai folgendes: > Hi, > > Is it possible to create a view from two different database tables? -- Yes, with dblink 08:17 < akretschmer> ??dblink 08:17 < rtfm_please> For information about dblink 08:17 < rtfm_please> see http://developer.postgres

Re: [GENERAL] r trim of characters other than space

2006-02-08 Thread A. Kretschmer
am 09.02.2006, um 11:54:43 +0530 mailte surabhi.ahuja folgendes: > Hi > hi i have varchar type fiels in a table. > > i want to make the following check, > > if it is having carets in the end, then those carets be removed. > > so if i get a string like abc def > > i should be able to g

Re: [GENERAL] How to use pg_stat_activity correctly ?

2006-02-10 Thread A. Kretschmer
am 10.02.2006, um 15:30:02 +0700 mailte Luki Rustianto folgendes: > Hi All, > > I try to query on pg_stat_activity but the returned result is only like this: > > teramedv2=> select * from pg_stat_activity where datname='teramedv2'; > datid | datname | procpid | usesysid | usename | current_qu

Re: [GENERAL] implicit cast of empty string to timestamp

2006-02-10 Thread A. Kretschmer
am 10.02.2006, um 20:22:57 +1100 mailte James Harper folgendes: > Is there anything I can do to make postgres allow an implicit cast of an > empty string to a timestamp, so that a badly behaved application can do: test=# select * from t1; x - foo (2 rows) test=# select case when x='' the

Re: [GENERAL] usage of copy command in pgsql

2006-02-16 Thread A. Kretschmer
am 16.02.2006, um 17:13:22 +0530 mailte rama krishna folgendes: > I have to copy the file to a table data base > the command used for this is COPY >But it showing the error like no permission is granted to > read the file. >for this i gave 777 permissions to that file ev

Re: [GENERAL] Non-Overlaping date interval index

2006-02-18 Thread A. Kretschmer
am 18.02.2006, um 10:03:11 +0100 mailte Pailloncy Jean-Gerard folgendes: > Hi, > > I wonder how to have a sort of "uniq" index on date interval, such that > there is no date interval overlaping in the table. > > exemple: > create table test (start timestamp, end timestamp); > with the constrai

Re: [GENERAL] psql Copy question

2006-02-20 Thread A. Kretschmer
am 19.02.2006, um 23:24:57 -0800 mailte Virag Saksena folgendes: > Hi, > I am using copy command in psql to load several million rows from a file > Is it possible to have a progress indicator print a dot after every 100,000 > rows are inserted ? split the file into files with only 100,000 ro

Re: [GENERAL] How to determine number of established connections

2006-02-20 Thread A. Kretschmer
am 20.02.2006, um 19:39:55 +0200 mailte Andrus folgendes: > When connectiong to database my application needs to determine how many > connections is currently established to Postgres server. select * from pg_stat_activity ; > I can create temporary table at startup of each connection. But how t

Re: [GENERAL] actual SQL statement

2006-02-23 Thread A. Kretschmer
am 23.02.2006, um 10:58:12 +0100 mailte MG folgendes: > Hello, > > can I find out, what SQL statement the PostgreSQL-server is executing? select * from pg_stat_activity; You should enable 'stats_command_string' in postgresql.conf. Btw.: please, no HTML HTH, Andreas -- Andreas Kretschmer

Re: [GENERAL] Limitations : Number of ...

2006-02-23 Thread A. Kretschmer
am 23.02.2006, um 10:00:01 -0800 mailte Jon Cruz folgendes: > Two quick questions : > > What is the max number of databases on a PostgreSQL server? > What is the max number of tables in a database ? Please, read our FAQ. http://www.postgresql.org/docs/faqs.FAQ.html And yes: we don't have limi

Re: [GENERAL] psql is very slow

2006-02-24 Thread A. Kretschmer
am 22.02.2006, um 16:23:16 +0100 mailte Michal Merta folgendes: > Hi all, > > I have a psql 7.3.4, apache 2.0.40, perl v5.8.0. Database is pretty big, > (dump is about 100Megs). > But all the operations are very, very slow. - 7.3 is very, very old, newer verions are much faster! - runs vacuum!

Re: [GENERAL] implicit tables syntax disappeared from 8.0->8.1

2006-02-28 Thread A. Kretschmer
am 28.02.2006, um 14:01:44 +0100 mailte [EMAIL PROTECTED] folgendes: > update t1 > set t1f1='test' > where t1.t1f2=t2.t2f2 > and t1.t1f3=t2.t2f3; > > unfortunately, now I get the error that t2 is not in the FROM clause. You can set add_missing_from in yout postgresql.conf, but please rea

Re: [GENERAL] Postgres does not accept socket connections

2006-03-02 Thread A. Kretschmer
am 02.03.2006, um 4:37:02 -0800 mailte [EMAIL PROTECTED] folgendes: > Hi All, > > I have the following problem. > > I am able to access a PostgreSQL database only as "localhost". If I try > to open psql from a different machine with -h option, then I get the > following error message. > > The

Re: [GENERAL] Logging seq scans

2006-03-07 Thread A. Kretschmer
am 07.03.2006, um 11:59:18 +0100 mailte Guido Neitzer folgendes: > Hi. > > Is there a way to set up logging in a way that I can see queries which > trigger seq scans? Or to log queries "taking longer than xx ms"? Yes, of cource. You can define log_min_duration_statement = 100 to log all quer

Re: [GENERAL] About updates

2006-03-10 Thread A. Kretschmer
am 10.03.2006, um 10:46:39 -0500 mailte Emi Lu folgendes: > Hello, > > postgresql 8.0.1, in a plpgsql function > > To update columns' values in a table (without OID), if I ran: > 1. "update table1 set col1 = ..., col2 = ... ... col100 =" > > or > 2. > "update table1 set col1 = " > ... > "update

Re: [GENERAL] Logging of sql statements?

2006-03-23 Thread A. Kretschmer
am 23.03.2006, um 14:07:11 +0100 mailte Bjørn T Johansen folgendes: > Is it possible to log the actual statement that the server runs? At the > moment, the statement that is > logged, is logged using ? for parameters; I would like to log the statement > after the parameters have been > substitut

Re: [GENERAL] SELECT beer FROM pub WHERE location = 'Europe'

2006-03-23 Thread A. Kretschmer
am 23.03.2006, um 10:37:26 -0600 mailte Jim C. Nasby folgendes: > I'm in Brussels until Wednesday; should anyone be interested in grabbing > a beer or 3 somewhere drop me an email. Nice idea ;-), but too far for me. Regards, Andreas -- Andreas Kretschmer(Kontakt: siehe Header) Heynitz: 03

Re: [GENERAL] pgadmin

2006-03-24 Thread A. Kretschmer
am 24.03.2006, um 19:13:56 + mailte Mary Adel folgendes: > Is the server running on host "xxx.xxx.xxx.xxx" and accepting > TCP/IP connections on port 5432? > > how i can solve this > can anyone help?? You have a good error-message ;-) My guess: you should check your pg_hab.conf. http://ww

<    2   3   4   5   6   7   8   >