Re: [GENERAL] Call a program

2007-05-28 Thread A. Kretschmer
am Tue, dem 22.05.2007, um 16:19:55 -0400 mailte Pablo Hume folgendes: > Hi, sorry for my english, i?m from Paraguay. > > I need to know if exists a way to call a program like CMD (command prompt) > from > a procedure or a trigger, and execute an external application. Yes, this is possible. You

Re: [GENERAL] Adding auto-increment / sequence

2007-05-28 Thread A. Kretschmer
am Mon, dem 21.05.2007, um 18:29:46 -0700 mailte camb folgendes: > Hey all, > Is there any way to add some kind of sequence of auto-incrementing > column to the result set returned by a SELECT? Yes. You can use an sequence similar this: test=# select * from foo; col1 | col2 | col3 --+

Re: [GENERAL] Will a DELETE violate an FK?

2007-05-29 Thread A. Kretschmer
am Tue, dem 29.05.2007, um 10:48:21 -0400 mailte Robert James folgendes: > I'd like to be able to detect if a record has associations. I don't want to > actually delete it, just know if it could be deleted. (This is to build an > intelligent menu on a GUI) Set a savepoint, try to delete the recor

Re: [GENERAL] general features

2007-06-03 Thread A. Kretschmer
am Sun, dem 03.06.2007, um 10:34:47 +0200 mailte Badawy, Mohamed folgendes: > Hi all > > am very new to postgres & actually am just collecting information about but I > having a problem with time so I was asking if someone could help me with quick > anserws about these features in postgres. > >

Re: [GENERAL] Foreign keys and indexes

2007-06-05 Thread A. Kretschmer
am Tue, dem 05.06.2007, um 11:49:20 +0200 mailte Marc Compte folgendes: > Dear list, > > This might be too basic for a question but I just couldn't find the > answer so far. > > Does PostgreSQL create an implicit index also for foreign keys? No, only for primary keys to enforce the uniqueness.

Re: [GENERAL] How to count pairs?

2007-06-10 Thread A. Kretschmer
am Sun, dem 10.06.2007, um 13:41:27 +0200 mailte Andrej Kastrin folgendes: > Dear all, > > I need to count all pairs of instances which occure under given ID > number, e.g.: > > ID word > - > 1 car > 1 fruit > 2 car > 2 fruit > 2 vegetable > 3 car > 3 vegetable > > A

Re: [GENERAL] Create a table B with data coming from table A

2007-06-12 Thread A. Kretschmer
am Mon, dem 11.06.2007, um 21:23:59 - mailte [EMAIL PROTECTED] folgendes: > My original table is like that: > > IDA1 A2 A3 cnt > 1234 1 0 0 4 > 1234 1 0 1 8 > 1234 1 1 1 5 > 1235 1 0 0 6 > 1235 1

Re: [GENERAL] Historical Data Question

2007-06-14 Thread A. Kretschmer
am Thu, dem 14.06.2007, um 10:57:43 -0700 mailte Lza folgendes: > Can anyone help me with this problem? > > I have a table in my database that holds information on policies and > this table is linked to a number of other tables. I need to be able to > keep a history of all changes to a policy ove

Re: [GENERAL] "Constant" fields in a table

2007-06-15 Thread A. Kretschmer
am Fri, dem 15.06.2007, um 10:24:26 +0200 mailte Adrian von Bidder folgendes: > Hi, > > I want to tighten down my db schema as much as possible against accidential > corruption. For this, I'd like to have fields that can only inserted and > not later changed (think some sort of "id", account n

Re: [GENERAL] Historical Data Question

2007-06-15 Thread A. Kretschmer
am Fri, dem 15.06.2007, um 8:21:45 -0400 mailte Francisco Reyes folgendes: > Lza writes: > > >I have a table in my database that holds information on policies and > >this table is linked to a number of other tables. I need to be able to > >keep a history of all changes to a policy over time. The

Re: [GENERAL] Exec a text variable as select

2007-06-18 Thread A. Kretschmer
am Mon, dem 18.06.2007, um 10:14:32 -0300 mailte Ranieri Mazili folgendes: > Hello, > > I'm creating a function that will create a select statement into a > while, this select will be stored into a text variable, after while ends > I need to execute this query stored into variable, on SQLSERVER

Re: [GENERAL] Loop through all views with PHP

2007-06-18 Thread A. Kretschmer
am Mon, dem 18.06.2007, um 14:59:34 +0200 mailte Stefan Schwarzer folgendes: > Hi there, > > my app is creating views for a certain task; now, I would like to run > on a regular basis a script which deletes these views. As they are > named with the date/hour/min/sec-appendix to make each view

Re: [GENERAL] How to prevent modifications in a tree of rows, based on a condition?

2007-06-19 Thread A. Kretschmer
am Tue, dem 19.06.2007, um 12:23:51 +0200 mailte Philippe Lang folgendes: > > I'd like to prevent any kind of modification (insert, update, delete) in > a order (and its lines, and steps) if all the steps in the lines of the > order are "checked". If that condition is not true, a modification is

Re: [GENERAL] date time function

2007-06-28 Thread A. Kretschmer
am Thu, dem 28.06.2007, um 16:04:48 -0400 mailte Jasbinder Singh Bali folgendes: > Hi, > > I have a timestamp field in my talbe. > I need to check its difference in days with the current date. > > field name is time_stamp and I did it as follows: > > select age(timestamp '2000-06-28 15:39:47.2

Re: [GENERAL] Create user

2007-06-29 Thread A. Kretschmer
am Fri, dem 29.06.2007, um 13:31:03 +0530 mailte Ashish Karalkar folgendes: > Hello All, > > I am trying to create a user and i dont understand why it is showing me any > massage even after giving parameter -e to the command. Maybe you should use -q: -q --quiet Do not display

Re: [GENERAL] Tables not created in proper schema

2007-07-02 Thread A. Kretschmer
am Mon, dem 02.07.2007, um 11:13:54 +0530 mailte Ashish Karalkar folgendes: > Hello All, > I am trying to create databse with script. > I run this script from root prompt with command > > > $ su - postgres -c 'path to script.sql' > > > In the script I follow following steps > > > 1) cr

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 0

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 functi

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? http://

Re: [GENERAL] Database Insertion commitment

2007-07-09 Thread A. Kretschmer
am Mon, dem 09.07.2007, um 2:53:48 -0400 mailte Jasbinder Singh Bali folgendes: > Hi, > > If I have a series of Insert statements within a loop in a function on the > same > table. > Would an Insert be able to see the values of previous insert in that table ? Inside this function, yes. Outsid

Re: [GENERAL] free scheduled import utility

2007-07-10 Thread A. Kretschmer
am Tue, dem 10.07.2007, um 14:32:58 +0200 mailte Zlatko Matic folgendes: > Hello. > Is there any free program/utility for batch imports from .csv files, that > can be easily scheduled for daily inserts of data to PostgreSQL tables? > Regards, You can use the scheduler from your OS. For Unix-like

Re: [GENERAL] odbc parameters

2007-07-11 Thread A. Kretschmer
am Wed, dem 11.07.2007, um 14:15:02 +0200 mailte Zlatko Matic folgendes: > Hello, please don't hijack other threads. If you only change the subject for a new question, your mail will be sorted completely wrong. (within modern email-clients such thunderbird or mutt) > > I use MS Access for data

Re: [GENERAL] odbc parameters

2007-07-11 Thread A. Kretschmer
am Wed, dem 11.07.2007, um 14:55:28 +0200 mailte Zlatko Matic folgendes: > I have already tried COPY. > But, it has problems with type castings. > For example, COPY operation fails because PostgreSQL can't copy value > 7.844,000 into NUMERIC field... Either copy such values into a temp. table wi

Re: [GENERAL] multirow insert

2007-07-13 Thread A. Kretschmer
am Fri, dem 13.07.2007, um 18:50:26 +0200 mailte Zlatko Mati? folgendes: > When using multirow INSERT INTO...VALUES command, are all rows inserted in a > batch, or row by row? Within one transaction, yes. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -

Re: [GENERAL] redirecting output of pg_dump

2007-07-18 Thread A. Kretschmer
am Wed, dem 18.07.2007, um 15:39:01 +0530 mailte Ashish Karalkar folgendes: > Hello all, > > I want to take backup from one server and save it to another machine hard > drive. > The backup will be taken through a shell script attached to a cron job. > > something like: > > pg_dump -d postgr

Re: [GENERAL] Using COALESCE nside function

2007-07-23 Thread A. Kretschmer
am Mon, dem 23.07.2007, um 13:58:22 -0400 mailte Robert Fitzpatrick folgendes: > Is it possible to use COALESCE function inside a function as a cursor > variable? Yes, why not? > > test cursor (myvar varchar) for > (coalesce(SELECT...,0)); I guess: wrong syntax. Try instead select co

Re: [GENERAL] regexp_replace

2007-07-24 Thread A. Kretschmer
am Mon, dem 23.07.2007, um 7:50:35 -0700 mailte [EMAIL PROTECTED] folgendes: > Hi all, > > I would like to change a sub-string in a text-field by using > > UPDATE tablename SET > fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string) > WHERE (fieldname like '%old_sub_string%') > > I

Re: [GENERAL] Database Select Slow

2007-08-10 Thread A. Kretschmer
am Fri, dem 10.08.2007, um 17:46:11 +0800 mailte carter ck folgendes: > Hi all, > > I am facing a performance issue here. Whenever I do a count(*) on a table > that contains about 300K records, it takes few minutes to complete. Whereas > my other application which is counting > 500K records jus

Re: [GENERAL] INSERT before UPDATE?

2007-08-16 Thread A. Kretschmer
am Thu, dem 16.08.2007, um 10:30:01 +0200 mailte Ji?í N?mec folgendes: > Hello, > > I would like to ask you for an advice. > > There are two tables in my PostgreSQL database - main table with datas and > second with translations for all languages of these records. > > When I try to UPDATE a rec

Re: [GENERAL] INSERT before UPDATE?

2007-08-16 Thread A. Kretschmer
am Thu, dem 16.08.2007, um 14:11:07 +0200 mailte Ji??í N??mec folgendes: > > see > > http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE > > Yes I see, but I'll try to describe it in more detail: > > I could write plpgsql trigger function which wi

Re: [GENERAL] Help creating a function

2007-08-20 Thread A. Kretschmer
am Wed, dem 15.08.2007, um 17:29:17 -0400 mailte Madison Kelly folgendes: > What I would like to do is create a function that would do the same > thing so I could read out the IP addresses as standard dotted-decimal > format. Could anyone help me with this? I am quite the n00b when it > comes

Re: [GENERAL] history table

2007-08-21 Thread A. Kretschmer
am Tue, dem 21.08.2007, um 20:20:38 +0200 mailte Robin Helgelin folgendes: > Hi, > > I want to save history for a few tables using triggers on update and > creation. What's the best approach to do this in a webapp environment > where I want to save which webapp user that is doing the change, not

Re: [GENERAL] [ERROR] syntax error at end of input

2007-08-27 Thread A. Kretschmer
am Mon, dem 27.08.2007, um 9:40:45 -0300 mailte Marcelo de Moraes Serpa folgendes: > Hello list, > > I'm trying to execute the following sentences in a pl/pgsql function. > aNomeProcAudita and pTabAudit are both variables. > >DROP FUNCTION IF EXISTS aNomeProcAudita; Which version?

Re: [GENERAL] Read Access to database

2007-08-27 Thread A. Kretschmer
am Tue, dem 28.08.2007, um 10:56:38 +0530 mailte Ashish Karalkar folgendes: > Hello all, > > I have a database abc with owner c . > I want to grant only read access on this DB abc to user d. > More specificaly to a schema abcs in the databse abc. > Is ther any way to do so? > > I have more

Re: [GENERAL] One database vs. hundreds?

2007-08-28 Thread A. Kretschmer
am Tue, dem 28.08.2007, um 8:08:36 -0400 mailte Kynn Jones folgendes: > I'm hoping to get some advice on a design question I'm grappling with. > I have a database now that in many respects may be regarded as an > collection of a few hundred much smaller "parallel databases", all > having the sam

Re: [GENERAL] One database vs. hundreds?

2007-08-28 Thread A. Kretschmer
am Tue, dem 28.08.2007, um 14:23:00 +0200 mailte Kamil Srot folgendes: > > Kynn Jones wrote: > >I'm hoping to get some advice on a design question I'm grappling with. > > I have a database now that in many respects may be regarded as an > >collection of a few hundred much smaller "parallel databa

Re: [GENERAL] How to avoid "Seq Scans"?

2007-08-29 Thread A. Kretschmer
am Wed, dem 29.08.2007, um 11:15:21 +0200 mailte Vincenzo Romano folgendes: > This loop is increadibly slow. Infact the friendly explain tells me > that: > > test=# explain select * from t order by f2,f3; >QUERY PLAN > --

Re: [GENERAL] \copy only select rows

2007-08-30 Thread A. Kretschmer
am Thu, dem 30.08.2007, um 14:59:06 +0800 mailte Ow Mun Heng folgendes: > Is there a way to do a dump of a database using a select statement? A complete database or just a simple table? > > eg: \copy trd to 'file' select * from table limit 10 Since 8.2 you can use COPY (select * from table) T

Re: [GENERAL] temp tables and sequences in functions

2007-09-05 Thread A. Kretschmer
am Wed, dem 05.09.2007, um 6:58:30 -0700 mailte Rob folgendes: > What is the proper why to deal with temp tables and sequences? Why aren't they > being dropped after the function ends? Why do I get OID errors if I delete the > temp table/sequence at the end of the function and then try to rerun t

Re: [GENERAL] Tutorial EXPLAIN for idiots?

2007-09-07 Thread A. Kretschmer
am Fri, dem 07.09.2007, um 12:30:06 +0200 mailte Erwin Moller folgendes: > Hi group, > > Does anybody know of an tutorial for EXPLAIN for idiots like me? > (I am fairly confortable with Postgres, but never used EXPLAIN before.) > > I need to optimize a few slow running queries, but I am not real

Re: [GENERAL] Database reverse engineering

2007-09-08 Thread A. Kretschmer
am Sat, dem 08.09.2007, um 11:44:17 +0200 mailte Thorsten Kraus folgendes: > Hello, > > I am looking for a tool which is able to generate a database diagramm > including the relationships from an existing database schema. The only > tool I know for this purpose is the Clay database plugin for e

Re: [GENERAL] Timestamp from an OID?

2007-09-12 Thread A. Kretschmer
am Wed, dem 12.09.2007, um 7:32:45 -0600 mailte Dennis Muhlestein folgendes: > I've been passively collecting data for a few months. I realized, after > a while, that I never added a timestamp column to the table the data is > being stored in. I've since added that. > > Is there a way to fin

Re: [GENERAL] Timestamp from an OID?

2007-09-12 Thread A. Kretschmer
am Wed, dem 12.09.2007, um 15:41:44 +0200 mailte A. Kretschmer folgendes: > am Wed, dem 12.09.2007, um 7:32:45 -0600 mailte Dennis Muhlestein folgendes: > > I've been passively collecting data for a few months. I realized, after > > a while, that I never added a timestamp

Re: [GENERAL] get a list of table modifications in a day?

2007-09-13 Thread A. Kretschmer
am Thu, dem 13.09.2007, um 10:44:41 +0200 mailte Ottavio Campana folgendes: > > http://ads.wars-nicht.de/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html > > since I already use triggers on that table, can I use table_log? > > I mean, can I have two triggers for the same even

Re: [GENERAL] UPDATE pg_catalog.pg_class as NO Superuser??

2007-09-13 Thread A. Kretschmer
am Thu, dem 13.09.2007, um 11:25:39 +0200 mailte Kai Behncke folgendes: > But always if I sent as user xy the > "UPDATE pg_catalog.pg_class SET reltriggers = 0;"-command I get: > > "SQL error: > > ERROR: permission denied for relation pg_class" > > Why is that? MUST I be a superuser for that?

Re: [GENERAL] UPDATE pg_catalog.pg_class as NO Superuser??

2007-09-13 Thread A. Kretschmer
am Thu, dem 13.09.2007, um 13:06:11 +0200 mailte Kai Behncke folgendes: > > why dont you simply alter table disable trigger? > > > > depesz > > > Could you give me an example for that please? > Thank you very much :-), Kai Open psql and type: \h alter table test=*# \h alter table Command:

Re: [GENERAL] ON INSERT => execute AWK/SH/EXE?

2007-09-18 Thread A. Kretschmer
am Mon, dem 17.09.2007, um 18:50:46 +0200 mailte Bima Djaloeis folgendes: > Hi there, > > I am new to PostgreSQL, is it possible to create something so that > > 1) If I insert / update / delete an item from my DB... > 2) ... an awk / shell / external program is executed in my UNIX System? > > I

Re: [GENERAL] help w/ SRF function

2007-09-18 Thread A. Kretschmer
am Mon, dem 17.09.2007, um 9:21:22 +0800 mailte Ow Mun Heng folgendes: > CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate > timestamp, code text) > RETURNS SETOF foo AS > $BODY$ > SELECT > TRH.ID, > TRH.data1, > TRH.data2, > FROM D > INNER JOIN

Re: [GENERAL] how to know the current size of a database

2007-09-19 Thread A. Kretschmer
am Wed, dem 19.09.2007, um 22:36:02 +1200 mailte [EMAIL PROTECTED] folgendes: > Hello > > I want to know about the size of my database. For example, I want to know > how many Mb of data for current myDatabase database in a postgres server. http://www.postgresql.org/docs/8.1/interactive/functions

Re: [GENERAL] Stuck on Foreign Keys

2007-09-19 Thread A. Kretschmer
am Thu, dem 20.09.2007, um 14:13:40 +1000 mailte Chester folgendes: > Hi > > I have a question regarding foreign keys, I just cannot get it to create > them for meI must be doing something wrong but I have no idea what > that might be :) > > I have a table "clients" > > clientID (primary)

Re: [GENERAL] more problems with count(*) on large table

2007-09-28 Thread A. Kretschmer
am Fri, dem 28.09.2007, um 11:56:46 -0400 mailte Mike Charnoky folgendes: > Hi, > > I am still having problems performing a count(*) on a large table. This > > Now, certain count(*) queries are failing to complete for certain time > ranges (I killed the query after about 24 hours). The table i

Re: [GENERAL] more problems with count(*) on large table

2007-09-28 Thread A. Kretschmer
am Fri, dem 28.09.2007, um 12:50:34 -0400 mailte Alvaro Herrera folgendes: > A. Kretschmer wrote: > > am Fri, dem 28.09.2007, um 11:56:46 -0400 mailte Mike Charnoky folgendes: > > > Hi, > > > > > > I am still having problems performing a count(*) on a

Re: [GENERAL] multiple row insertion

2007-10-04 Thread A. Kretschmer
am Thu, dem 04.10.2007, um 18:47:01 +0500 mailte test tester folgendes: > > > On 10/4/07, test tester <[EMAIL PROTECTED]> wrote: > > i have version 8.1 and i want to know how to insert multiple rows in this > version. Please no silly top post. You can insert multiple values with one i

Re: [GENERAL] Error while database creation

2007-10-04 Thread A. Kretschmer
am Fri, dem 05.10.2007, um 11:43:09 +0530 mailte Ashish Karalkar folgendes: > Hello All, > > I am getting following error when trying to create new database. > > > createdb: database creation failed: ERROR: could not create directory "base/ > 1923827": No space left on device > can anybody

Re: [GENERAL] How to convert rows into HTML columns?

2007-10-04 Thread A. Kretschmer
am Fri, dem 05.10.2007, um 8:20:32 +0200 mailte Stefan Schwarzer folgendes: > Before I was used that the yearly values were all to be found in a > single SQL row; now for each year of each country I have a separate > row. How do I convert that into a single (HTML) row again? You can use cond

Re: [GENERAL] How to convert rows into HTML columns?

2007-10-05 Thread A. Kretschmer
am Fri, dem 05.10.2007, um 9:13:10 +0200 mailte Stefan Schwarzer folgendes: > >> > >>And the next question coming up is: How should my query look like so > >>that I can sort the (HTML) table by a specific year in ascending or > >>descending order? So, that it doesn't display it by the country nam

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-05 Thread A. Kretschmer
am Fri, dem 05.10.2007, um 10:05:32 -0400 mailte Bill Bartlett folgendes: > Quick request to the group: we have several members who include bogus or > "humorous" X-Message-Flag headers in their email messages. Could I > request that you _please_ turn them off? Because they come through as Do yo

Re: [GENERAL] Problem with SELECT

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 3:28:04 -0700 mailte marwis1978 folgendes: > I have a following table > -+ > day | quantity > -+ > > where day is a date and quantity is an integer value. Now I need to > make a SELECT statement on this table which returns me a full > informati

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 13:05:50 -0400 mailte Bill Bartlett folgendes: > > > (Makes me have to think twice about raising > > > any _real_ issues though, like why my VACUUMs periodically keep > getting > > > into lock contentions with my JDBC connections and ultimately > causing me > > > to have

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 12:00:30 -0700 mailte Richard Broersma Jr folgendes: > --- "A. Kretschmer" <[EMAIL PROTECTED]> wrote: > > > > at least post them and see what kind of response you get, > > > > rather than judge the list as a whole due to th

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 15:46:04 -0500 mailte Scott Marlowe folgendes: > Actually CC to the sender is the norm on this list. I believe there Okay, no problem. I'm knowing other lists like the german debian user list and there is this CC to the sender unwanted. Andreas -- Andreas Kretschmer

Re: [GENERAL] not work in IE

2007-10-11 Thread A. Kretschmer
am Fri, dem 12.10.2007, um 5:06:38 +0100 mailte manju arumugam folgendes: > Hi, > > > In my site when am update the edit user info page its > prperly works in firefox .But not works in IE...But > the updation takes place in the database but the page > is not displayed...Wats the reason? IE is

Re: [GENERAL] DROP VIEW lasts forever

2007-10-17 Thread A. Kretschmer
am Wed, dem 17.10.2007, um 13:01:25 +0200 mailte Christian Rengstl folgendes: > Hi list, > > Whenever I try dropping a view using DROP VIEW myschema.myview the > query runs forever. The last time I tried was ten minutes ago and the > query is still running even though the view queries just data o

Re: [GENERAL] Suggestions for Remote Procedure Calls from PG, please?

2007-10-17 Thread A. Kretschmer
am Wed, dem 17.10.2007, um 22:30:26 -0400 mailte Bret Schuhmacher folgendes: > Does anyone else invoke a process on a remote server? How do you do it? You can use any untrusted programming language like pl/perlU or plsh. Other solution: use LISTEN/NOTIFY, see http://www.postgresql.org/docs/8.2/i

Re: [GENERAL] PG/Tcl and Expect?

2007-10-18 Thread A. Kretschmer
am Tue, dem 16.10.2007, um 21:55:38 -0700 mailte Bret Schuhmacher folgendes: > Does the PG/Tcl interface allow expect scripts? I want to create a stored > procedure that ssh's to another server and runs a Perl script. Expect could > do > it, but can I load the expect module from pgtcl? I think

Re: [GENERAL] "Concatenate" two queries - how?

2007-10-24 Thread A. Kretschmer
am Wed, dem 24.10.2007, um 15:08:51 +0200 mailte Stefan Schwarzer folgendes: > Now, I want to enable queries which display national as well as > regional values. I could probably work with independent queries, but > I think it would be "cleaner" and more efficient to get everything > into a

Re: [GENERAL] Delete/Update with ORDER BY

2007-10-25 Thread A. Kretschmer
am Thu, dem 25.10.2007, um 5:25:14 -0700 mailte Evandro Andersen folgendes: > In Oracle you can use this: > > > > DELETE FROM A WHERE A1 = 10 ORDER BY A2 > > > > There is something in the Postgresql ? Can you explain this a little bit more? I can't see any sense. Either i delete rows with

Re: [GENERAL] Query_time SQL as a function w/o creating a new type

2007-10-26 Thread A. Kretschmer
am Fri, dem 26.10.2007, um 14:51:52 +0800 mailte Ow Mun Heng folgendes: > > On Fri, 2007-10-26 at 08:35 +0200, Reg Me Please wrote: > > You could try this: > > > > > > CREATE OR REPLACE FUNCTION foo( out procpid integer, out client_addr inet, > > out > > query_time interval, out current_query

Re: [GENERAL] active connections

2007-10-30 Thread A. Kretschmer
am Tue, dem 30.10.2007, um 14:51:33 -0300 mailte João Paulo Zavanela folgendes: > Hi, > > I would like to know how many active connections exist. > Is necessary show the number ip of client. ask pg_stat_activity (select * from pg_stat_activity;) Andreas -- Andreas Kretschmer Kontakt: Heynitz

Re: [GENERAL] how can I shut off "more"?

2007-10-31 Thread A. Kretschmer
am Wed, dem 31.10.2007, um 17:14:02 -0400 mailte Gauthier, Dave folgendes: > When I run a query, and the number of lines exceeds what the screen can hold, > the results seem to get piped into ?more? (or ?less?). How can I turn that > off > and just have everything stream out without stopping?

Re: [GENERAL] day of week

2007-11-01 Thread A. Kretschmer
am Wed, dem 31.10.2007, um 16:34:44 +0200 mailte Anton Andreev folgendes: > Hi, > > I have records with date column. Is there a way I can get which day of > week this date is? Yes, no problem. select extract (dow from date). Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1

Re: [GENERAL] Would an index benefit select ... order by?

2007-11-02 Thread A. Kretschmer
am Sat, dem 03.11.2007, um 11:09:05 +0400 mailte rihad folgendes: > Hi, > > Should an index be used on a created_at timestamp column if you know you > will be using "ORDER BY created_at ASC|DESC" from time to time? Yes. And you should use EXPLAIN. Andreas -- Andreas Kretschmer Kontakt: Heyn

Re: [GENERAL] reverse strpos?

2007-11-12 Thread A. Kretschmer
am Mon, dem 12.11.2007, um 10:54:53 -0500 mailte Gauthier, Dave folgendes: > Is there a function that?ll return the position of the last occurance of a > char > in a string? > > > > For Example, in the string ?abc/def/ghi? I want the position of the 2^nd ?/?. write a function to revert the

Re: [GENERAL] reverse strpos?

2007-11-12 Thread A. Kretschmer
am Mon, dem 12.11.2007, um 8:48:29 -0800 mailte David Fetter folgendes: > > > Is there a function that?ll return the position of the last > > > occurance of a char in a string? > > > > > > > write a function to revert the string and use strpos(). > > > > create or replace function rev(varchar

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

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

Re: [GENERAL] Trigger problem

2007-11-27 Thread A. Kretschmer
am Tue, dem 27.11.2007, um 10:38:09 +0100 mailte Christian Rengstl folgendes: > Hi list, > > act = 'DELETION of row with id: ' || OLD.id; > act = 'UPDATE OF ' || field || ' with id: ' || > ... > INSERT INTO history(aennam, action, table_name) VALUES(current_user, > act, ta

Re: [GENERAL] Making a query from 2 tables at same time

2007-11-29 Thread A. Kretschmer
am Thu, dem 29.11.2007, um 15:48:45 +0100 mailte Pau Marc Munoz Torres folgendes: > Hi everybody > > I'm doing a two table query as follow > > mhc2db=> select t1.sp, t1.pos,t2.p1, t2.p4, t2.p6, t2.p7, t2.p9 from local as > t1, precalc as t2 where t1.ce='ACIAD' and t2.idr(p1, p4, p6, p7, p9, >

Re: [GENERAL] Moving lock file (/tmp/.s.PGSQL.)

2007-11-30 Thread A. Kretschmer
am Fri, dem 30.11.2007, um 5:22:34 -0500 mailte Madison Kelly folgendes: > Hi all, > > If there a ./configure switch (or config file/command line switch) to > tell postgresql to put the lock file '.s.PGSQL..lock' and socket > '.s.PGSQL.' in a different directory? > > Thanks all! Option uni

Re: Fwd: Re: [GENERAL] Archiving problem on Windows

2007-12-04 Thread A. Kretschmer
am Tue, dem 04.12.2007, um 11:31:41 +0100 mailte Christian Rengstl folgendes: > When I login as user postgres, I can copy the files without any > problem. > Here is the error message (translated as it appears in German in my log > files): > >>copy pg_xlog\myfile C:\Archive\DBArchive\myfile<< faile

Re: [GENERAL] Archiving problem on Windows

2007-12-04 Thread A. Kretschmer
am Mon, dem 03.12.2007, um 12:29:39 +0100 mailte Christian Rengstl folgendes: > Hi list, > > a have a problem using the following archiving command on windows: > 'copy %p C:\\Archive\\DBArchive\\%f' According the doc, the command should be: archive_command = 'copy "%p" /mnt/server/archivedir/"%

Re: [GENERAL] Archiving problem on Windows

2007-12-04 Thread A. Kretschmer
am Tue, dem 04.12.2007, um 12:05:41 +0100 mailte Christian Rengstl folgendes: > >> a have a problem using the following archiving command on windows: > >> 'copy %p C:\\Archive\\DBArchive\\%f' > > > > According the doc, the command should be: > > > > archive_command = 'copy "%p" /mnt/server/archi

Re: [GENERAL] SQL Query

2007-12-05 Thread A. Kretschmer
am Wed, dem 05.12.2007, um 10:24:04 + mailte Ashish Karalkar folgendes: > Hello List member, > > Iha a table containing two columns x and y . for single value of x there are > multiple values in y e.g > > X Y > > 1 ABC > 2 PQR > 3 XYZ > 4 LMN > 1

Re: [GENERAL] Problem with joining two tables

2007-12-05 Thread A. Kretschmer
am Wed, dem 05.12.2007, um 14:42:32 +0100 mailte Przemyslaw Bojczuk folgendes: > Hello! > > I have a problem joining two tables. I tried various types of join and > none seems to work as I expect > > Table 1: > > id | stuff > --- > 1 | sth1 > 2 | sth2 > 3 | sth3 > 4 | sth4 >

Re: [GENERAL] SQL Query

2007-12-05 Thread A. Kretschmer
am Wed, dem 05.12.2007, um 3:46:26 -0800 mailte David Fetter folgendes: > Use the array_accum aggregate from the docs as follows: > > SELECT x, array_to_string(array_accum(y),':') > FROM your_table > GROUP BY x; Yes, no noubt a better solution as my new aggregat... Andreas -- Andreas Kretsch

Re: [GENERAL] SQL Query

2007-12-05 Thread A. Kretschmer
am Wed, dem 05.12.2007, um 10:47:44 + mailte Ashish Karalkar folgendes: > > X Y > > > > 1 ABC > > 2 PQR > > 3 XYZ > > 4 LMN > > 1 LMN > > 2 XYZ > > > > I want a query that will give me following output > > > > 1 ABC:LMN > > 2 PQR

Re: [GENERAL] simple update on boolean

2007-12-06 Thread A. Kretschmer
am Thu, dem 06.12.2007, um 10:25:26 +0100 mailte Cedric Boudin folgendes: > Most honourable members of the list, > > this is a simple one, but I can't find the solution ( probably a > forest/tree problem). > > update table set bolean_column = set_it_to_its_inverse where fk = > some_value; test=

Re: [GENERAL] how to redirect output to a file

2007-12-06 Thread A. Kretschmer
am Tue, dem 04.12.2007, um 20:19:29 -0800 mailte pc folgendes: > Hi, > > How to redirect the output of an sql command to a file? > Thanks in advance within psql you can use \o , from the shell you can use this: [EMAIL PROTECTED]:~$ echo "select now()" | psql test > now.txt [EMAIL PROTECTED]:~$

Re: [GENERAL] Error in creating function

2007-12-06 Thread A. Kretschmer
am Thu, dem 06.12.2007, um 4:16:14 -0800 mailte Yancho folgendes: > I am trying to create a function, which takes the nearest 3 hospitals > to a point making use of a PostGIS function), and then check each > hospital for the exact distance on roads (by making use of a pgRouting > function). > >

Re: [GENERAL] Restore problem

2007-12-10 Thread A. Kretschmer
am Mon, dem 10.12.2007, um 12:30:14 -0800 mailte Keith Turner folgendes: > Hi first post here, I hope you can help. > > We are running 8.1 on Windows 2003 server and have had a server crash > over the weekend. A virus is suspected - we maintain an app server on Please don't hijack other threads,

Re: [GENERAL] Hijack!

2007-12-11 Thread A. Kretschmer
am Tue, dem 11.12.2007, um 14:57:57 + mailte Richard Huxton folgendes: > Keith Turner wrote: > >Someone scolding wrote: I wrote this ;-) > > > >Please don't hijack other threads, the original thread was 'TIMESTAMP > >difference'. > > I think it was probably intended as a *gentle* scolding.

Re: [GENERAL] very slow query

2007-12-12 Thread A. Kretschmer
am Wed, dem 12.12.2007, um 11:44:58 + mailte Ashish Karalkar folgendes: > Hi, > I am having PostgreSQL 8.2.4 on Suse 10.3 > > Server is not using the index insted it chooses to take seq scan path. table > is > having @ 120 million rows > > here is the output from planner: > Nested Loop IN J

Re: [GENERAL] very slow query

2007-12-12 Thread A. Kretschmer
am Wed, dem 12.12.2007, um 12:25:20 + mailte Ashish Karalkar folgendes: > > here is the output from planner: > > Nested Loop IN Join (cost=0.00..5030217.97 rows=2 width=106) > > -> Seq Scan on sms_new (cost=0.00..5027902.00 rows=384 width=106) > > Filter: (mobile = 919820920858

Re: [GENERAL] very slow query

2007-12-12 Thread A. Kretschmer
am Wed, dem 12.12.2007, um 12:44:09 + mailte Ashish Karalkar folgendes: > > Do you have an index on "mobile"? Can you show us the table definition > > and the output from EXPLAIN ANALYSE? > > > > no index on mobile > > Seq Scan on sms_new ... Filter: (mobile = 919820920858

Re: [GENERAL] executing a procedure with delay

2007-12-12 Thread A. Kretschmer
am Wed, dem 12.12.2007, um 14:43:55 +0100 mailte Pavel Stehule folgendes: > Hello > > you can use pg_sleep function. But using it in trigger is ugly, > because transaction stay in open state. Look to orafce on intersession > communication. Maybe you can use it. other solution (vaguely): LISTEN/N

[GENERAL] data type change on a view

2007-12-12 Thread A. Kretschmer
Hello @all, i have a question (rot really for myself, a member of ther german forum asks): i have two tables, contains a varchar(N)-column. Now i create a VIEW based on this tables. The resulting view contains now a varchar without length. How can i prevent this? How can i force that the column i

Re: [GENERAL] Password as a command line argument to createuser

2007-12-18 Thread A. Kretschmer
am Tue, dem 18.12.2007, um 22:04:13 -0800 mailte Jane Ren folgendes: > Hi, > > I need to write a script that creates a new user with a password > automatically. > > Is there a way I can specify the password as a command line argument to > createuser? >From a unix shell? You can call psql with -

Re: [GENERAL] Quick Regex Question

2007-12-20 Thread A. Kretschmer
am Thu, dem 20.12.2007, um 10:36:08 + mailte Howard Cole folgendes: > Your expression works fine Richard, as does '(^| )ho', but can you tell > me why '[ ^]ho' doesn't work? With ^ you means an anchor, but within the brackets it's a simple char. Andreas -- Andreas Kretschmer Kontakt: Hey

Re: [GENERAL] Quick Regex Question

2007-12-20 Thread A. Kretschmer
am Thu, dem 20.12.2007, um 12:03:57 +0100 mailte Martijn van Oosterhout folgendes: > On Thu, Dec 20, 2007 at 11:51:34AM +0100, A. Kretschmer wrote: > > am Thu, dem 20.12.2007, um 10:36:08 + mailte Howard Cole folgendes: > > > Your expression works fine Richard, as does

Re: [GENERAL] postgresql long text column

2007-12-26 Thread A. Kretschmer
am Wed, dem 26.12.2007, um 10:08:13 -0500 mailte Josh Harrison folgendes: > Hi > I have a question about postgres long text column values. > How does it handles these long text column values? Does it put all the long > text columns values from all the tables in one single place or separately? PG

Re: [GENERAL] quick question abt pg_dump and restore

2008-01-09 Thread A. Kretschmer
am Wed, dem 09.01.2008, um 9:02:23 -0500 mailte Josh Harrison folgendes: > Hi, > When restoring the pg_dumped data thro psql does the rows of the table are > restored in the same order? ie for example if > Table A has rows r1,r2,r3,r4,r5 in this order, then if I pg_dump and restore > it > to ano

  1   2   3   4   5   6   7   8   >