Re: [GENERAL] Transaction with in function

2010-05-25 Thread A. Kretschmer
In response to Ravi Katkar : > > > I looking for solution for commit, rollback with in function. You can't use transactions within functions, use savepoints instead. http://www.postgresql.org/docs/current/static/sql-savepoint.html Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread A. Kretschmer
In response to Stephen Frost : > * m. hvostinski (makhv...@gmail.com) wrote: > > I have a simple query like: > > > > SELECT * FROM customer WHERE id IN (23, 56, 2, 12, 10) > > > > The problem is that I need to retrieve the rows in the same order as the set > > of ids provided in the select statem

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread A. Kretschmer
In response to Sam Mason : > Isn't this fun; here's another version using window functions (from PG > 8.4 onwards) this time: > > SELECT c.* > FROM customer c, ( > SELECT *, row_number() OVER () > FROM (VALUES (23), (56), (2), (12), (10)) x) x(val,ord) > WHERE c.id = x.val > ORDER

Re: [GENERAL] Is there a way to backup Postgres via SQL commands?

2010-06-14 Thread A. Kretschmer
In response to Frank Church : > Are there SQL commands that can do a backup over a client connection, > rather than from the command line like pgsql etc? > > By that I mean some kind of SELECT commands that can retrieve the > database's content as SQL commands that can be replayed to a server to >

Re: [GENERAL] Ideal Disk recommendation for PostgreSQL

2010-06-15 Thread A. Kretschmer
In response to Bhaskar Sirohi : > Hi All, > > We are right now in initial phase to setup a production server having > PostgreSQL database installed and would require help with Disk configuration. > The database size would grow approx to 500 GB. I have gone through the > following link http://momji

Re: [GENERAL] disable password prompt - command line

2010-06-21 Thread A. Kretschmer
In response to Ravi Katkar : > > > Hi List, > > > > I need a small help regarding the password options available with PGSQL, I > found POSTGRE SQL has ?W and ?password options available which is prompting > for > the password. But I want to take the password thru command line argument and >

Re: [GENERAL] Single quotes vs. double quotes when setting a pwd and other cmds

2010-06-23 Thread A. Kretschmer
In response to Alexander Farber : > Hello, > > why aren't double quotes accepted below? > > db1=# alter user user1 password "pass1"; > ERROR: syntax error at or near ""pass1"" > LINE 1: alter user user1 password "pass1"; > ^ > db1=# alter user user1 password 'pas

Re: [GENERAL] Single quotes vs. double quotes when setting a pwd and other cmds

2010-06-23 Thread A. Kretschmer
In response to Alexander Farber : > And identifiers means column names (eventually containing whitespace)? Right. test=# select 'foo' as "my new column"; my new column --- foo (1 row) Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr:

Re: [GENERAL] Need Some Recent Information on the Differences between Postgres and MySql

2010-06-25 Thread A. Kretschmer
In response to Dave Page : > On Fri, Jun 25, 2010 at 9:52 AM, Thom Brown wrote: > > > Didn't PostgreSQL used to have more than 1 storage engine in the past? > >  I thought I read somewhere it did, but it was decided it was a > > compromise on stability and/or quality, so ended up using a single >

Re: [GENERAL] Need Some Recent Information on the Differences between Postgres and MySql

2010-06-25 Thread A. Kretschmer
In response to John Gage : > Forgive me for being somewhat stupid, but is MyISAM a text search > engine? The Wikipedia article doesn't make it sound like one. MyISAM provides textsearch and other features, but no referential integrity. It's just one of many storage engines. > > Could you be m

Re: [GENERAL] alter table schema, default sequences stay the same

2010-06-29 Thread A. Kretschmer
In response to Sim Zacks : > I am using 8.2.17 > > I added a new schema and moved tables into it using > > ALTER TABLE tblname SET SCHEMA newschema; > > > This moves the sequences referred to by the table to the new schema as > is specified by the manual. > > > Associated indexes, constraints,

Re: [GENERAL] alter table schema, default sequences stay the same

2010-06-29 Thread A. Kretschmer
In response to Scott Marlowe : > On Tue, Jun 29, 2010 at 8:20 AM, A. Kretschmer > wrote: > > > > > > Just for info: works well with 8.4: > > Works in 8.3.9 on ubuntu 9.10... > I think, this is the problem: You have created the table first and later the seq

Re: [GENERAL] Scheduling backup

2010-06-30 Thread A. Kretschmer
In response to RP Khare : > Is there any way to schedule PGSQL databases backups? I want to take hourly > dumps of my production database. You can use the OS-scheduler, for instance, CRON for UNIX-like systems. Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/

Re: [GENERAL] Problem with temporary tables

2010-06-30 Thread A. Kretschmer
In response to Andrea Lombardoni : > Hello. > > > The strange part is that the second time, the OID of the idmap is the > same as the one in the first invocation! > > Am I doing something wrong or is this a bug? The plan is cached, to avoid this problem, use dynamic SQL. In your case: EXECUTE

Re: [GENERAL] Postgres table contents versioning

2010-06-30 Thread A. Kretschmer
In response to John Gage : > Is there an equivalent of svn/git etc. for the data in a database's > tables? > > Can I set something up so that I can see what was in the table two > days/months etc. ago? You can use tablelog: 15:53 < akretschmer> ??tablelog 15:53 < pg_docbot_adz> For informati

Re: [GENERAL] extracting total amount of time from an interval

2010-07-01 Thread A. Kretschmer
In response to Andrew Geery : > Is there a way to extract the total amount of time in a given unit from an > interval?  For example, I would like to know the total number of milliseconds > in an interval. > > The expression > > select extract('seconds' from '5 minutes'::interval) > > returns the

Re: [GENERAL] psql \dp equivalent or similar query?

2010-07-06 Thread A. Kretschmer
In response to Davor J. : > I couldn't find it on the net. I also coudn't find any reference to it in > the psql source? > > Anyone any suggestions? Start your psql with option -E to display the query behind: kretsch...@tux:~$ psql -E test psql (8.4.2) Type "help" for help. test=# \dp foo

Re: [GENERAL] Why can't I see the definition of my relations

2010-07-12 Thread A. Kretschmer
In response to Andrew Falanga : > Hi, > > I just finished defining a couple of tables with PgAdmin III and I'm > seeing something peculiar. I'm not sure what the problem is. When I > connect to the DB using psql and do "\d " I get an error saying > that there's not relations by that name. What?

Re: [GENERAL] resource management, letting user A use no more than X resource (time, CPU, memory...)

2010-07-16 Thread A. Kretschmer
In response to Ivan Sergio Borgonovo : > If I'd like to learn how to manage resources in postgres and grant > different users different time slot/memory/CPU? > > eg. I'd like to grant to user A to execute queries that last less > than 1min or that occupy no more than X Mb... etc... Isn't (real) p

Re: [GENERAL] resource management, letting user A use no more than X resource (time, CPU, memory...)

2010-07-16 Thread A. Kretschmer
In response to Ivan Sergio Borgonovo : > > If you need strong user resource limits, user storage limits, etc > > PostgreSQL might not be your best option. There are some things > > you can do, but there's not much. > > What about an external process that monitor backend and kill them > gracefully

Re: [GENERAL] Rescue data after power off

2010-07-19 Thread A. Kretschmer
In response to tuanhoanganh : > Is there anyway to rescue data afer power off. > I have postgres database version 8.3.9 on windows 2003. > Yesterday my server is power off, when i start server, some of table is blank. > Is there anyway to rescue it. Restore the data from your backup. You haven't a

Re: [GENERAL] Difference between EXPLAIN ANALYZE SELECT ... total runtime and SELECT ... runtime

2010-07-22 Thread A. Kretschmer
In response to Piotr Gasid??o : > Hello, > > I have strange problem. > > I test/optimize my queries with EXPLAIN ANALYZE. I get for example: > > Total runtime: 40.794 ms > > But when I run query without EXPLAIN ANALYZE i get, for example: > > Time: 539.252 ms > > Query returns 33 rows. Why?

Re: [GENERAL] Re: What to do if space for database decrease and no additional hard drive is possible?

2010-07-26 Thread A. Kretschmer
In response to Ivan Voras : > * buy external storage (NAS, or even an external USB drive), move the > database to it buy external USB-Drive, and create a new tablespace, and move some large table into this new tablespace and/or use the new tablespace for new tables. You can also use table-partitio

Re: [GENERAL] What to do if space for database decrease and no additional hard drive is possible?

2010-07-26 Thread A. Kretschmer
In response to Vincenzo Romano : > 2010/7/26 A. Kretschmer : > > In response to Ivan Voras : > >> * buy external storage (NAS, or even an external USB drive), move the > >> database to it > > > > buy external USB-Drive, and create a new tablespace, and

Re: [GENERAL] Re: What to do if space for database decrease and no additional hard drive is possible?

2010-07-26 Thread A. Kretschmer
In response to Bill Thoen : > > > A. Kretschmer wrote: > >In response to Ivan Voras : > > > >>* buy external storage (NAS, or even an external USB drive), move the > >>database to it > >> > > > >buy external USB-Drive, and create

Re: [GENERAL] select a list of column values directly into an array

2010-07-27 Thread A. Kretschmer
In response to Gauthier, Dave : > Is there a way to select a list of column values directly into an array? > > > > create table foo (col1 text); > > insert into foo (col1) values (?aaa?),(?bbb?),(?ccc?),(?ddd?),(?eee?); > > > > I?d like to load up an array with {aaa,bbb,ccc,ddd,eee}, preff

Re: [GENERAL] How to improve: performance of query on postgresql 8.3 takes days

2010-07-29 Thread A. Kretschmer
In response to Dino Vliet : > I arrived at 15 functions because I had 7 or 8 joins in the past and saw that > my disk was getting hid and I had heard someplace that RAM is faster so I > rewrote those 7 or 8 joins as functions in pl/pgsql. They were just simple > lookups, although some of the functi

Re: [GENERAL] pg_hba.conf

2010-08-03 Thread A. Kretschmer
In response to quickinfo quickinfo : > Dear all, > > I am using postgres. when I try to connect to the database it is showing me > following error. Please look into that and help me out. > > an error occurred: > > FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database > "tem

Re: [GENERAL] optimal memory

2010-08-03 Thread A. Kretschmer
In response to Sim Zacks : > Is there a way to tell what the optimal memory is for a specific > postgresql instance? > > I am configuring Xen virtual machines and I don't want to give it more > then it needs. > > Would looking at the swap be an indication? As soon as it starts to use > swap, that

Re: [GENERAL] optimal memory

2010-08-03 Thread A. Kretschmer
In response to Sim Zacks : > > > On 03-Aug-2010 11:18 AM, A. Kretschmer wrote: > > In response to Sim Zacks : > > > >> Is there a way to tell what the optimal memory is for a specific > >> postgresql instance? > >> > >> I am configur

Re: [GENERAL] could you tell me this..?

2010-08-05 Thread A. Kretschmer
In response to ?? : > today, I found this situation. >   >   >   > Session 1. - >   > begin; > delete from ; >   >   > Session 2 - >   > delete from ; >   >   > thus, it occured row level locking. >   >   >   >   > so. i killed Session 1's PID with kill -9 commands >   >   > but. both s

Re: [GENERAL] could you tell me this..?

2010-08-05 Thread A. Kretschmer
In response to ?? : > so. i killed Session 1's PID with kill -9 commands What have you killed, the client or the postmaster? Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC

Re: [GENERAL] return setof : alternatives to holder table

2010-08-15 Thread A. Kretschmer
In response to zhong ming wu : > Hello List, > > I have a plpgsql function returning a set of records. The record is > effectively a join of some tables. > > For example, table a (column a1,column a2,column a3,column a4) > > table b(column b1,column b2,column b4) > > I am returning a set of (a

Re: [GENERAL] Index File locations

2010-08-27 Thread A. Kretschmer
In response to Callum Scott : > Hi All, > > I am looking for a way to define where index files should be located. > > I am wanting to store the index files on a separate SSD from the database > itself.  I can see that there is a way to define this from within the > database.  Is there a way to do

Re: [GENERAL] alter column to inet get error.

2010-09-03 Thread A. Kretschmer
In response to Steve Clark : > Hello List, > > I want to change some columns in a database > that were originally created as char varying to > inet. > > When I try I get an error. Is there anyway to work > around this? > > See below for table definition. > > Table "public.kernel

Re: [GENERAL] alter column to inet get error.

2010-09-03 Thread A. Kretschmer
In response to Steve Clark : > >Try this with explicet cast: > > Thanks guys, that seems to do the trick. Postgresql ROCKS!!! Yeah, definitively! You are welcome, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A32

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 13:33:55 +0200 mailte A B folgendes: > In my function I have (kept the important part) > > CREATE OR REPLACE FUNCTION foo() RETURNS SETOF RECORD AS $$ > DECLARE > retval RECORD; > BEGIN > some loop >retval.jd := tmp.id; >retval.d2 := _

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 13:57:22 +0200 mailte A B folgendes: > > Sure, declare your result like my example: > > > > test=# create or replace function ab() returns setof record as $$declare r > > record; begin select into r 1,2;return next r;end;$$language plpgsql; > > Unfortunatly I have not

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 14:25:30 +0200 mailte A B folgendes: > I did read the select line also, and > select * from foo() as (a integer, b integer, c integer); > gives me unfortunatly the error > ERROR: record "retval" is not assigned yet > DETAIL: The tuple structure of a not-yet-assigned re

Re: [GENERAL] Query Fails

2008-07-01 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 20:38:08 + mailte Sheikh Salman Ahmed folgendes: > > Hallo Fellows > > I am a new User of postgresql.I have installed it on window XP.I feel it > little > complicated on Window.I have already connected it with visual c++ 2005,but > when > i wanted to insert some

Re: [GENERAL] SAST FATAL: could not access private key file "server.key"

2008-07-01 Thread A. Kretschmer
am Tue, dem 01.07.2008, um 14:05:29 +0200 mailte Dave Coventry folgendes: > When starting Postgres I get the following: > > > [EMAIL PROTECTED]:/home/it# /etc/init.d/postgresql-8.2 start > * Starting PostgreSQL 8.2 database server > * The PostgreSQL server failed to start. Please chec

Re: [GENERAL] Insert into ... returning ... before 8.2?

2008-07-02 Thread A. Kretschmer
am Wed, dem 02.07.2008, um 11:58:19 +0200 mailte A B folgendes: > What should I replace the command > > INSERT INTO table (name) VALUES (value) RETURNING currval('my_id_seq') > into my_var; > > with if I have to use version 8.1? select currval('my_id_seq'); Andreas -- Andreas Kretschmer Kont

Re: [GENERAL] Functional index adding one

2008-07-03 Thread A. Kretschmer
am Thu, dem 03.07.2008, um 11:50:39 +0200 mailte [EMAIL PROTECTED] folgendes: > Hi all: > > I'm trying to create a functional index into column position of token > table (see below). I want to make something like: > > CREATE INDEX token_position_func > ON token (position+1); > > but I get: > >

Re: [GENERAL] select command doesnot work

2008-07-08 Thread A. Kretschmer
am Tue, dem 08.07.2008, um 21:46:53 +1000 mailte Long Cui folgendes: > HI > > I installed Postgresql 8.3.3 in windows XP, try to input some commands in > windows command prompt. The create, update and insert command work all right, > just select command.got the error message: "more" is not inte

Re: [GENERAL] SELECT Query returns empty

2008-07-09 Thread A. Kretschmer
am Wed, dem 09.07.2008, um 16:32:11 +0800 mailte Bright D.L. folgendes: > The scenario: > There are two separate processes ? one (P1) inserting (not > updating) data to a table at a high rate (around one record in 10ms) and > another (P2) selecting the data from the same table for furt

Re: [GENERAL] rollback

2008-07-09 Thread A. Kretschmer
am Wed, dem 09.07.2008, um 15:38:52 +0200 mailte Adrian Moisey folgendes: > Hi > > I would like to be able to "mark" a point in my postgres database. > After that I want to change a few things and "rollback" to that point. > Does postgres support such a thing? Is it possible for me to do this?

Re: [GENERAL] rollback

2008-07-09 Thread A. Kretschmer
am Wed, dem 09.07.2008, um 15:59:00 +0200 mailte Adrian Moisey folgendes: > Hi > > >>I would like to be able to "mark" a point in my postgres database. > >>After that I want to change a few things and "rollback" to that point. > >>Does postgres support such a thing? Is it possible for me to do

Re: [GENERAL] SPACE FOR POSTGRESQL DATABASE

2008-07-10 Thread A. Kretschmer
am Thu, dem 10.07.2008, um 7:18:39 -0700 mailte aravind chandu folgendes: > Hello, > > Can you please how much space does postgresql database occupies? > > Thank You, Depends on the amount of data stored in the database. Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz:

Re: [GENERAL] deleting the master but not the detail

2008-07-17 Thread A. Kretschmer
am Thu, dem 17.07.2008, um 11:11:00 -0500 mailte Ismael folgendes: > > hi > I have one of those master-detail relationships here and I need to be able > to delete the master but leave the details untouched > > But the delete command doesn't let me delete the master as long as > there are de

Re: [GENERAL] question about performance

2008-07-20 Thread A. Kretschmer
am Sun, dem 20.07.2008, um 20:08:21 +0200 mailte Robert Urban folgendes: > Hi PostgreSQLer, > > if I have a table, the_table, with a DATE field, i'll call it 'day', and > I'd like to find all rows whos day falls within a given month, which of the > following methods is faster/costs less: > > 1

Re: [GENERAL] question about performance

2008-07-21 Thread A. Kretschmer
am Mon, dem 21.07.2008, um 9:40:19 +0200 mailte Torsten Zühlsdorff folgendes: > A. Kretschmer schrieb: > > >>if I have a table, the_table, with a DATE field, i'll call it 'day', and > >>I'd like to find all rows whos day falls within a given month, w

Re: [GENERAL] Is it possible to do some damage to database with SELECT query?

2008-07-22 Thread A. Kretschmer
am Tue, dem 22.07.2008, um 12:50:31 +0300 mailte Teemu Juntunen folgendes: > Hi, First, don't hijack other threads! > > is it possible to make a SELECT query with some nasty follow up commands, > which damages the database. > > Something like: > > SELECT *,(DROP DATABASE enterprise) AS roge

Re: [GENERAL] A couple of newbie questions ...

2008-07-23 Thread A. Kretschmer
am Wed, dem 23.07.2008, um 19:18:15 +0930 mailte admin folgendes: > 1. Is a SEQUENCE what I use instead of auto_increment? Yes. > > 2. Does this work in PostgreSQL: > > INSERT INTO table VALUES ('x','y','z') > > or do I need to do this > > INSERT INTO table (fld_x,fld_y,fld_z) VALUES ('x','

Re: [GENERAL] Sequence

2008-07-24 Thread A. Kretschmer
am Fri, dem 25.07.2008, um 15:54:23 +1100 mailte Alex Cheshev folgendes: > Hello. > A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2 > integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command: > INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new

Re: [GENERAL] limit with subselect

2008-07-25 Thread A. Kretschmer
am Fri, dem 25.07.2008, um 12:02:23 +0200 mailte A B folgendes: > Sorry if this is a double posting, I think the previous message was lost. > > I have two tables > T ( > id int primary key, > a int, > b int > ) > > T2 ( > id int references T, > c int > ); > > and I wish to get 20 lines from T

Re: [GENERAL] only the last 3 records

2008-09-27 Thread A. Kretschmer
am Sat, dem 27.09.2008, um 9:13:48 +0200 mailte Alain Roger folgendes: > Hi, > > maybe it's a stupid question, but i do not remember how to query a table and > to > request only the latest 3 added records. > How can i do that (i have a field time and a field date) ? ... order by desc limit 3;

Re: [GENERAL] access public relation from a private database

2008-09-29 Thread A. Kretschmer
am Mon, dem 29.09.2008, um 17:43:21 +0530 mailte Joey K. folgendes: > > When I try to create a table in database nowhere that references public.foo > table, > > CREATE DATABASE nowhere; > \c nowhere; > CREATE TABLE bar (bar integer REFERENCES public.foo(fooid)); > > I get, ERROR: relation "pub

Re: [GENERAL] dbsamples from pgfoundry

2008-09-29 Thread A. Kretschmer
am Mon, dem 29.09.2008, um 22:52:52 +0100 mailte Tommy Gibbons folgendes: > Hi, > I would like some pointers as to how to install the dbsamples so that I can > use > them in Postgres. These .tar.qz files seem to contain *.sql files. These > seem > to be text files but I do not understand how t

Re: [GENERAL] Trigger disable for table

2008-10-02 Thread A. Kretschmer
am Thu, dem 02.10.2008, um 12:26:20 +0200 mailte Frank Durstewitz folgendes: > My idea is to have it like > ... > IF NEW.published = TRUE THEN >ALTER TABLE a DISABLE TRIGGER mytrigger USER; >(do update here) >ALTER TABLE a ENABLE TRIGGER mytrigger USER; > ... > > Will a construct like

Re: [GENERAL] Import German Number Format

2008-10-02 Thread A. Kretschmer
am Thu, dem 02.10.2008, um 15:35:44 +0200 mailte Tim Semmelhaack folgendes: > Hello, > > I have to import a huge number of data sets of data sets with "Copy from". > > The numbers are formatted with decimal comma ',' (as usual in Germany) > instead of the decimal point '.' > > When I try to imp

Re: [GENERAL] question

2008-10-07 Thread A. Kretschmer
am Tue, dem 07.10.2008, um 21:20:53 -0400 mailte Tom Lane folgendes: > Luis Castillo <[EMAIL PROTECTED]> writes: > > I would like to know how can I control in my database the rows that a > > user has inserted. I mean many users can insert information in a table > > but when trying to update the

Re: [GENERAL] How to find not unique rows in a table?

2008-10-08 Thread A. Kretschmer
am Wed, dem 08.10.2008, um 13:20:47 +0200 mailte A B folgendes: > Assuming you have a table where some rows have the same values in all > columnes, how do you find these rows? You can use the ctid-column: test=*# select * from dup; a | b ---+--- 1 | 1 1 | 2 2 | 1 1 | 1 3 | 3 3 | 3 (6 rows

Re: [GENERAL] databases list to file

2008-10-09 Thread A. Kretschmer
am Thu, dem 09.10.2008, um 15:13:58 +0100 mailte Joao Ferreira gmail folgendes: > Hello all, > > I need to print to a file a simple list of all the databases on my > postgresql. > > I need to do this from a shell script to be executed without human > intervention > > I guess something like: >

Re: [GENERAL] Update Query Problem

2008-10-10 Thread A. Kretschmer
am Fri, dem 10.10.2008, um 12:38:24 +0100 mailte Jeng Yu folgendes: > Hi People! > > I'm doing an application and I've chosen postgresql > for the backend db. I need to use SQL update command > like this in my application: > > update mytable set x='20' where id='someid' order by > id limit 1;

Re: [GENERAL] PL/pgSQL stored procedure returning multiple result sets (SELECTs)?

2008-10-13 Thread A. Kretschmer
am Mon, dem 13.10.2008, um 12:17:21 +0300 mailte Vladimir Dzhuvinov folgendes: > > However, after consulting the docs and running a few tests, it looks > like Postgresql misses a crucial feature which my application depends > upon - returning multiple SELECT result sets from functions/stored > pr

Re: [GENERAL] PL/pgSQL stored procedure returning multiple result sets (SELECTs)?

2008-10-13 Thread A. Kretschmer
am Mon, dem 13.10.2008, um 11:34:03 +0200 mailte A. Kretschmer folgendes: > or, simpler in plain sql: > > test=# create or replace function srf (OUT a int, OUT b int) returns setof > record as $$select 1,2;select 1,3;$$language sql; > CREATE FUNCTION > test=*# > test=*# &g

Re: [GENERAL] OR or IN ?

2008-10-13 Thread A. Kretschmer
am Tue, dem 14.10.2008, um 8:33:21 +0200 mailte Luca Ferrari folgendes: > Hi all, > I've got a query with a long (>50) list of ORs, like the following: > > SELECT colB, colC FROM table WHERE colA=X OR colA=Y OR colA=Z OR > > Is there any difference in how postgresql manages the above query

Re: [GENERAL] Numbering rows

2008-10-15 Thread A. Kretschmer
am Wed, dem 15.10.2008, um 12:23:42 -0700 mailte Richard Broersma folgendes: > On Wed, Oct 15, 2008 at 12:08 PM, ries van Twisk <[EMAIL PROTECTED]> wrote: > > May be this function can help : > > > > http://www.postgresql.org/docs/8.3/static/functions-srf.html > > Using generate series won't numbe

Re: [GENERAL] Are projected queries optimized like nonprojected ones

2008-10-16 Thread A. Kretschmer
am Thu, dem 16.10.2008, um 14:43:42 +0300 mailte Andrus folgendes: > I'm looking a hint for new application dynamic query builder creation for > PostgreSQL 8.0+ > > Following two queries return same results: > > SELECT ... > FROM t1 JOIN t2 USING (cx) > LEFT JOIN t3 USING (cy) > LEFT JOIN t4 US

Re: [GENERAL] sum the text of a text field

2008-10-29 Thread A. Kretschmer
am Wed, dem 29.10.2008, um 13:20:59 +0200 mailte Sim Zacks folgendes: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Is there any way (aside from creating a new aggregate type) to sum the > text in a text field. I would like to group on a query and concatenate > all the values of a specifi

Re: [GENERAL] Date data type

2008-11-02 Thread A. Kretschmer
am Mon, dem 03.11.2008, um 16:03:33 +0930 mailte Mike Hall folgendes: > Gday, > > I'm currently converting an MS Access database to PostgreSQL (version 8.1 as > it is the vesion that ships with CentOS 5). > > I'm having trouble with an INSERT statement attempting to insert an empty > value (''

Re: [GENERAL] time interval format srting

2008-11-04 Thread A. Kretschmer
am Tue, dem 04.11.2008, um 17:06:37 + mailte Joao Ferreira gmail folgendes: > Hello, > > I've been searching the docs on a simple way to convert a time > _duration_ in seconds to the format dd:hh:mm:ss, but I can't find it. > > 90061 --> 1d 1h 1m 1s > > (90061=24*3600+3600+60+1) > > any id

Re: [GENERAL] Get interval in months

2008-11-09 Thread A. Kretschmer
am Mon, dem 10.11.2008, um 12:06:04 +0700 mailte dbalinglung folgendes: > Dear Expert, First, please create a new thread for a new question. > > I have a function to getting time interval bellow : > > create or replace function scmaster.pr_gettimeinterval(time without time zone, > time with

Re: Put variable values on time interval (from : Re: [GENERAL] Get interval in months)

2008-11-09 Thread A. Kretschmer
am Mon, dem 10.11.2008, um 13:13:05 +0700 mailte dbalinglung folgendes: > >From: "A. Kretschmer" <[EMAIL PROTECTED]> > > > >First, please create a new thread for a new question. > > > > > > Sorry, ok i create new thread his is still the old

Re: [GENERAL] How to define automatic filter condition?

2008-11-11 Thread A. Kretschmer
am Wed, dem 12.11.2008, um 8:08:08 +0100 mailte Csaba Együd folgendes: > Hi All, > > --PG8.3 > --Windows 2k3 SBS > > I would like to apply an automatic filter condition to a table. I create a > TEMP table at the beginning of the session to store a value to build up a > filter condition and I wo

Re: [GENERAL] how to several records with same timestamp into one line?

2008-11-12 Thread A. Kretschmer
am Wed, dem 12.11.2008, um 18:57:42 +0800 mailte zxo102 ouyang folgendes: > Hi everyone, > My data with same timestamp "2008-11-12 12:12:12" in postgresql are as > follows > > rowid data unitchannel create_on >

Re: [GENERAL] How to define automatic filter condition?

2008-11-12 Thread A. Kretschmer
am Wed, dem 12.11.2008, um 11:10:41 +0100 mailte Csaba Együd folgendes: > Andreas, > thank you for your reply. Yes, I know that there is such a mathod but I > read somewhere that it is just a limited way. BTW, I am going to dig into > this more deeper. > > A possible solution has come into my

Re: [GENERAL] Urgent - Grant

2008-11-18 Thread A. Kretschmer
am Tue, dem 18.11.2008, um 11:25:16 -0300 mailte Gustavo Rosso folgendes: > People of world, help help please. > I created a DB with super-user postgres, I give all privileges to DB > (banco is my DB) > GRANT ALL ON DATABASE banco TO PUBLIC; > GRANT CREATE ON DATABASE banco TO PUBLIC > > But oth

Re: [GENERAL] Serial/sequence problem

2008-11-24 Thread A. Kretschmer
am Tue, dem 25.11.2008, um 16:41:43 +0930 mailte Mike Hall folgendes: > I have just imported 3636 rows into a PG database table (PG 8.1 on CentOS 5.2 > ... the default). > The rows were imported using separate INSERT statements for each row. All OK > so far. > > After having had a few attempts

Re: [GENERAL] Place of subselect

2008-11-24 Thread A. Kretschmer
am Tue, dem 25.11.2008, um 15:34:57 +0800 mailte Guillaume Bog folgendes: > Hi dear Postgres users. > > I have performance issues if I do the following pseudo-query: > > SELECT a, b, (SELECT count(*) FROM t2 WHERE something) AS c > FROM t1 ORDER BY a LIMIT 10; > > After some tests, it seems to

Re: [GENERAL] Place of subselect

2008-11-25 Thread A. Kretschmer
am Tue, dem 25.11.2008, um 16:44:34 +0800 mailte Guillaume Bog folgendes: > It seems that you are right. By further testing I found that a WHERE condition > in the subquery was making the query hundred times slower. As I'm not very > familiar with explain analyze, I paste them below. Why do I have

Re: [GENERAL] Syntac error

2008-11-25 Thread A. Kretschmer
am Tue, dem 25.11.2008, um 12:41:32 +0100 mailte Timo Erbach folgendes: > Hello, > > I've defined the following function and get an syntac error whle compiling. > Whats the fault? > > CREATE FUNCTION "myscheme"."authenticate" () RETURNS > "pg_catalog"."refcursor" AS > $body$ > DECLARE >curA

Re: [GENERAL] Executing a user created function twice give an error

2008-12-02 Thread A. Kretschmer
am Tue, dem 02.12.2008, um 11:11:44 + mailte Wajid Khattak folgendes: > Hi, > > PostgreSQL 8.1.11 > > I have created a function that works fine when run for the first time after > that it gives an error until I open another Query window. Use EXECUTE for DDL-Statements, for instance, creat

Re: [GENERAL] Job scheduling in Postgre

2008-12-02 Thread A. Kretschmer
am Tue, dem 02.12.2008, um 16:45:16 +0500 mailte IPS folgendes: > I have certain jobs to be executed automatically at a given interval of time > in the postgre SQL database. Is their any utility/feature available in Postgre > to do so. No, use the scheduler from the OS, CRON for example (UNIX).

Re: [GENERAL] Executing a user created function twice give an error

2008-12-02 Thread A. Kretschmer
am Tue, dem 02.12.2008, um 12:36:26 + mailte Wajid Khattak folgendes: > Thank for your reply. > > Could you please elaborate it a little bit further by referring to the > fucntion as I am quite new to Postgres. Sure, read the doku: http://www.postgresql.org/docs/current/static/plpgsql-stat

Re: [GENERAL] Recover data for one table from database dump

2008-12-01 Thread A. Kretschmer
am Tue, dem 02.12.2008, um 10:21:51 +0300 mailte Otandeka Simon Peter folgendes: > Hi, > > I need to know how I can easily get data for just one table from postgres dump > database backup. Binary dump for pg_restore? If so, you can use the -L - Option. ASCII-Dump: If so, edit the file. Andre

Re: [GENERAL] Executing a user created function twice give an error

2008-12-04 Thread A. Kretschmer
am Thu, dem 04.12.2008, um 9:23:31 + mailte Wajid Khattak folgendes: > Did try by encapsulating the create and drop queries within EXECUTE, but it > seems to be giving the same error. The changed function is as follows: You need to execute the insert-statement also: test=# create or replac

Re: [GENERAL] Job scheduling in Postgre

2008-12-04 Thread A. Kretschmer
am Thu, dem 04.12.2008, um 10:50:38 -0500 mailte Robert Treat folgendes: > On Tuesday 02 December 2008 07:11:02 A. Kretschmer wrote: > > am Tue, dem 02.12.2008, um 16:45:16 +0500 mailte IPS folgendes: > > > I have certain jobs to be executed automatically at a given interva

Re: [GENERAL] Job scheduling in Postgre

2008-12-04 Thread A. Kretschmer
am Thu, dem 04.12.2008, um 16:40:38 + mailte Dave Page folgendes: > >> There is a database level schedular called (iirc) pgAgent, which comes > >> bundled > >> with pgAdmin. I think it's so well hidden because it comes as a part of a > > > > How does it work? Independent from the OS? On the s

[GENERAL] re-using RETURNING

2009-11-12 Thread A. Kretschmer
Hi, just to be sure, it is still (8.4) not possible to use RETURNING within an other INSERT? To show what i mean: test=*# insert into foo2 (id1, id2) (insert into foo(n) values ('a'),('b'),('c') returning currval('some_sequence'), id); ERROR: syntax error at or near "insert" LINE 1: insert int

Re: [GENERAL] safelly erasing dirs/files

2009-11-14 Thread A. Kretschmer
In response to Joao Ferreira gmail : > Hello all, > > How can I safelly erase (with rm command in Linux) files or dirs > concerning a specific database ? Don't do that! > > assuming I whish to elimiante data belonging to database A but I do not > whish to disturb or cause any injury to database

Re: [GENERAL] dumping parts of a database

2009-11-16 Thread A. Kretschmer
In response to Malm Paul : > Hi List, > I have a database with two tables header and idata, they are connected with an > conn_ID. > I would like to dump header and the connected idata tables with a certain > conn_ID. This I would like to import to the same type of database on another > PostgreSQL s

Re: [GENERAL] Comparing bit in an integer field

2009-11-16 Thread A. Kretschmer
In response to Amitabh Kant : > Hello > > I need to compare the bit values of a integer field in my table. For > example, I > have a table called "t1" with just one field "a1" having following values: > > a1 > == > 0 > 12 > 8 > 0 > 1 > 10 > 7 > 19 > > I am trying to fetch all records where the

Re: [GENERAL] Allowing for longer table names (>64 characters)

2009-11-20 Thread A. Kretschmer
In response to Allan Kamau : > Hi all, > I would like to increase the database objects names limit from 64 > characters to may be 128 characters to avoid name conflicts after > truncation of long table/sequence names. > I have seen a solution to this sometime back which includes (building > from so

Re: [GENERAL] Allowing for longer table names (>64 characters)

2009-11-20 Thread A. Kretschmer
In response to Allan Kamau : > Thanks Andreas, I too agree it may not be a good idea to have long for > various reasons including porting/upgrading issues and so on, as I > have many tables, I seem to have been caught up in describing table > functionality in the table name :-) The table-name is t

Re: [GENERAL] using window-functions to get freshest value - how?

2009-11-20 Thread A. Kretschmer
In response to hubert depesz lubaczewski : > On Fri, Nov 20, 2009 at 11:07:37AM +0100, Massa, Harald Armin wrote: > > Is it possible? How would the SQL utilizing WINDOW-functions look like? > > there is no point in using window functions in here - simply use > "DISTINCT ON". Right, but he want to

Re: [GENERAL] using window-functions to get freshest value - how?

2009-11-20 Thread A. Kretschmer
In response to Massa, Harald Armin : > > > Is it possible? How would the SQL utilizing WINDOW-functions look like? > > > > there is no point in using window functions in here - simply use > > "DISTINCT ON". > > and how would I use DISTINCT ON for this query? Please bear in mind, > that there is mo

Re: [GENERAL] How well clustered is a table?

2009-11-22 Thread A. Kretschmer
In response to Jonathan Blitz : > I was wondering if there is some indication of how well clustered a table is. > > In other words, when a Cluster command is performed then a table would be 100% > clustered. > As updates etc are made the table clowly loses its clustering. > Is there any indicatio

Re: [GENERAL] Access a Field / Column of a resultset by Number

2009-11-29 Thread A. Kretschmer
In response to Daniel Schuchardt : > hy group, > > i currently look for a solution to access a resultset in a db-stored > function by number. in plpgsql thats not possible. Can you wait until 8.5? http://okbob.blogspot.com/2009/10/dynamic-access-to-record-fields-in.html Regards, Andreas --

Re: [GENERAL] Postgres Dump out of order

2009-12-02 Thread A. Kretschmer
In response to Helio Campos Mello de Andrade : > Hi guys, > >  - I'm having a problem when i want to make a backup of my system. >  - Postgres generated dump was created out of "foreing key" order and when i > try to recreate my database structures, data and functions. Does someone have > this sam

<    1   2   3   4   5   6   7   8   >