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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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 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] 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] pg_dump cannot connect when executing by a script

2010-05-25 Thread A. Kretschmer
In response to Luca Ferrari : > Hi all, > I've found in the net a lot of problems similar to mine, but not the solution > for my case: when I executed pg_dump against a database from a script (that > will be executed by cron) I got the following error: > > pg_dump: [archiver (db)] connection to

Re: [GENERAL] getting all constraint violations

2010-05-21 Thread A. Kretschmer
In response to Gauthier, Dave : > Hi: > > > > I have a table with many constraints. A user tries to insert a record that > violates many of them. The error message I get back lists the first > violation. > How cani I (or can I) get them all? I think that isn't possible: the first violation

Re: [GENERAL] copy data from one db into another via copy & psql

2010-05-20 Thread A. Kretschmer
In response to Kevin Kempter : > Can I copy from one db (via COPY) and pipe the results to a psql/COPY stmt so > I can load the data into a table in the second db 'inline' without writing to > & reading from a flat file? Yes, but keep in mind, COPY cant create the table on the destination. If th

Re: [GENERAL] default ordering of query result - are they always guarantee

2010-05-19 Thread A. Kretschmer
In response to Guillaume Lelarge : > > This is the default behavior I want. However, I am not sure whether this is > > always guarantee? Or shall I explicitly make the query in the following > > form? > > An you're right. It's not guaranted. The only guaranted way is to use > ORDER BY your_colum

Re: [GENERAL] creating a table based on a table in stored in another database

2010-05-18 Thread A. Kretschmer
In response to Malm Paul : > Hi list, > in a database I have different kind of tables. I would like to take the meta > data from one of those tables and create the same type of table (but empty) > in another database. > Can anyone, please, tell me how to do this? Create a schema-only dump and r

Re: [GENERAL] Weird unique constraint

2010-05-12 Thread A. Kretschmer
In response to Mike Christensen : > I have the following constraint which almost works: > > ALTER TABLE ingredientforms ADD CONSTRAINT > ingredientforms_UniqueIngredientForm UNIQUE(IngredientId, > FormDisplayName); > > However, I want to allow rows that have the same IngredientId > FormDisplayNam

Re: [GENERAL] Pulling data from a constraint def

2010-05-11 Thread A. Kretschmer
In response to Gauthier, Dave : > I have a constraint defined on a table > > constraint design_style_is_invalid check (design_style in > ('rls','sdp','rf','ssa','rom','rpt','analog','sdprpt','clkdist','global')), > > Is there a way to get the valid values in the list from the metadata somehow

Re: [GENERAL] log database in which error occurs

2010-05-11 Thread A. Kretschmer
In response to Alexander Pyhalov : > May 11 01:36:46 pgsql pgsql[73794]: [7-3] STATEMENT: select count(*) > from forum_msg where grp_id=6709 (200 ok) ACCEPTED and is_blocked='f' > > Are there any ways to log database, to which invalid query was issued ? Sure: log_line_prefix = '%t '

Re: [GENERAL] Performance issues when the number of records are around 10 Million

2010-05-11 Thread A. Kretschmer
In response to venu madhav : > Hi all, >In my database application, I've a table whose records can > reach 10M and insertions can happen at a faster rate like 100 > insertions per second in the peak times. I configured postgres to do > auto vacuum on hourly basis. I have frontend GUI applic

Re: [GENERAL] PG 8.3.7. Windows 7. select inet_server_addr() returns ::1 - the loopback adrs.

2010-05-09 Thread A. Kretschmer
In response to Abraham, Danny : > The machine is on IPV4. > > How can I retrieve the real IP adrs? kretsch...@tux:~$ psql -h localhost test Password: Timing is on. psql (8.4.2) SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) Type "help" for help. test=# select inet_server_addr(); inet_se

Re: [GENERAL] Dynamic SQL with pgsql, how to?

2010-05-03 Thread A. Kretschmer
In response to Andre Lopes : > Hi, > > I need to write some dynamic SQL in pgsql. > There is documentation on how can I do this in pgsql? Sure, http://www.postgresql.org/docs/8.4/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN Regards, Andreas -- Andreas Kretschmer Kontakt: Hey

Re: [GENERAL] temp tables

2010-04-30 Thread A. Kretschmer
In response to Geoffrey : > Do temp tables need to be explicitly dropped, or do the go away when the > process that created them leaves? The latter one. But explicitely delete them isn't an error. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Heade

Re: [GENERAL] using between with dates

2010-04-29 Thread A. Kretschmer
In response to Geoffrey Myers : > I'm trying the following: > > ship_date between '04/30/2010' AND '04/30/2010' + 14 > > But this returns: > > ERROR: invalid input syntax for integer: "04/30/2010" > > Can I use between with dates? Sure, why not, but you have to CAST your STRING into a DATE, o

Re: [GENERAL] Complete row is fetched ?

2010-04-16 Thread A. Kretschmer
In response to Raymond O'Donnell : > On a related note, what happens when you do something like this? - > > select count(*) > > Does any data actually get read? No, it check's only the visibility for each record -> seq-scan. > > Is there any difference internally to saying "count(1)" in

Re: [GENERAL] Complete row is fetched ?

2010-04-15 Thread A. Kretschmer
In response to Satish Burnwal (sburnwal) : > I have a ques - say I have a table that has 10 columns. But in a simple > select query from that table, I use just 3 columns. I want to know > whether even for fetching 3 columns, read happens for all the 10 columns > and out of that the required 3 colum

Re: [GENERAL] How to get whether user has ALL permissions on table?

2010-04-15 Thread A. Kretschmer
In response to dipti shah : > Thanks Kretschmer but I have seen those function. The below query returns > error > but you could see that 'user1' has ALL permissions on table 'techtable'. >   > techdb=# SELECT has_table_privilege('user1', 'techtable', 'ALL'); > ERROR:  unrecognized privilege type:

Re: [GENERAL] How to get whether user has ALL permissions on table?

2010-04-15 Thread A. Kretschmer
In response to dipti shah : > > Hi, I have granted ALL permissions on 'techtable' to 'user1'. >   >  techdb=# select pc.relname, pc.relacl from pg_class pc, pg_namespace pn where > pc.relnamespace=pn.oid and pn.nspname='techdb' and pc.relname='techtable'; >  relname   |

Re: [GENERAL] [SOLVED] Error in Trigger function. How to correct?

2010-04-14 Thread A. Kretschmer
In response to Andre Lopes : > Thanks a lot, it works! > > I'am using Postgres Plus Advanced Server 8.3R2 in development.In production I > user PostreSQL 8.3.9. Yeah, AFAIK is the "Postgres Plus Advanced Server" the version of the regular PG-version plus 1. So you have 8.2 as development and 8.3

Re: [GENERAL] Error in Trigger function. How to correct?

2010-04-14 Thread A. Kretschmer
In response to Andre Lopes : > Hi, > > I have a trigger that runs in my Development machine but not in my Production > machine. the code is the following: > SQL Error: > > ERROR:  function replace(text, unknown, integer) does not exist > LINE 1: select replace(replace(replace(replace(replace(repl

Re: [GENERAL] beginner problems with count(*)

2010-04-08 Thread A. Kretschmer
In response to Me Self : > Hello Im just getting started using postgres and Ive run run into a > problem with count(*): > > When I do "select count(*) from mytable" or "select count(*) from > mytable where mycolumn=x" then I get wrong number. The number of rows > returned is lower than the actual

Re: [GENERAL] Running/cumulative count using windows

2010-03-30 Thread A. Kretschmer
In response to Oliver Kohll - Mailing Lists : > Hello, > > I'm still reasonably new to windowing functions, having used a few since 8.4 > came out. I wonder if anyone can help with this one. > > I've got a table of email addresses in a CRM system similar to the following: > > CREATE TABLE test(

Re: [GENERAL] How long will the query take

2010-03-29 Thread A. Kretschmer
In response to John Gage : > I ran a query out of pgAdmin, and (as I expected) it took a long > time. In fact, I did not let it finish. I stopped it after a little > over an hour. > > I'm using 8.4.2 on a Mac with a 2.4GHz processor and 2GB of RAM. > > My question is: is there a way to tell

Re: [GENERAL] best practice in archiving CDR data

2010-03-29 Thread A. Kretschmer
In response to Juan Backson : > Hi, > > I am using Postgres to store CDR data for voip switches.  The data size > quickly > goes about a few TBs.   > > What I would like to do is to be able to regularly archive the oldest data so > only the most recent 6 months of data is available.   > > All t

[GENERAL] question (or feature-request): over ( partition by ... order by LIMIT N)

2010-03-24 Thread A. Kretschmer
Hello @all, I know, i can do: select * from (select ... row_number() over (...) ...) foo where row_number < N to limit the rows per group, but the inner select has to retrieve the whole set of records and in the outer select most of them discarded. Why isn't there an over ( ... LIMIT N) ? Oth

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread A. Kretschmer
In response to Tuo Pe : > Hello! > > I am teaching myself PL/pgSQL. I am trying to write a function that tests > whether two time periods overlap. I want to test the function parameters > against these two values in "overlaptest" table: > > select * from overlaptest; > id |alku

Re: [GENERAL] Create a function that updates the record with and timestamps

2010-03-22 Thread A. Kretschmer
In response to Richard Sickler : > > I am not sure if there is a very simple way of doing this? > > > > Or, do I need to create a function and a trigger to call the row and > update > > with new data and set the last_modified to current_date? > > Yes, that's the way, a TRIG

Re: [GENERAL] Create a function that updates the record with and timestamps

2010-03-22 Thread A. Kretschmer
In response to Chris Barnes : > I would like to have postgres update the last_modified column with the > current_date on an update of the record. > > I am not sure if there is a very simple way of doing this? > > Or, do I need to create a function and a trigger to call the row and update > with

Re: [GENERAL] Help me with this tricky join

2010-03-21 Thread A. Kretschmer
In response to Jay : > Thanks! > But, since the master can contain many users (user2, user3, and so on) > I suppose this won't be a proper solution? > Sorry if I was a bit unclear in my description. > > I.e., the master is of the form: > > user_id date > User1 20010101 > User1 2101 > User1 19

Re: [GENERAL] How to dump JUST procedures/funnctions?

2010-03-21 Thread A. Kretschmer
In response to Carlo Stonebanks : > Is pg_get_functiondef an 8.4 appears to be an 8.4 function? Yes, new since 8.4. > > I don't see it in the 8.3 documentation and the servers in question are all > 8.3. > > Any alternatives for 8.3? pg_proc has the code body, but not the function > declarati

Re: [GENERAL] return row from plpgsql?

2010-03-16 Thread A. Kretschmer
In response to zhong ming wu : > Hello > > I have tried to return rowtypes and record from plpgsql > but they don't look like anything what is returned from select a,b,c > from table d; Can you show us your function? > I prefer to do this simply as > > select aplpgsqlfunction('%u') > > The

Re: [GENERAL] Unable to connect to Postgres database from email marketing software on the same host

2010-03-15 Thread A. Kretschmer
In response to Major Services : > Not sure how to check the server-log? Please help. > > New to Postgres & Linux! Just read the logfile, it's usually somewhere under /var/log/postgresql. On my machine for instance /var/log/postgresql/postgresql-8.4-main.log > > > On Mon, Mar 15, 2010 at 5:48

Re: [GENERAL] Unable to connect to Postgres database from email marketing software on the same host

2010-03-15 Thread A. Kretschmer
In response to Major Services : > Error message is "Server call failed for unknown reason" Okay, i know from the other post, you have also a proper host-entry. Well, this error-message isn't helpfull, can you see in the server-log for a more detailed error message? Regards, Andreas -- Andreas

Re: [GENERAL] Unable to connect to Postgres database from email marketing software on the same host

2010-03-15 Thread A. Kretschmer
In response to Major Services : > Hi, > > I have an email marketing software installed on the same server as > PostgresSQL database. > Am unable to connect to the database from this application. The > database owner is dbadmin. Error-message? > > My pg_hba.conf has one entry as: > > local al

Re: [GENERAL] querying the value of the previous row

2010-03-11 Thread A. Kretschmer
In response to Chris Velevitch : > I'm to write a query like:- > > select > case when column_name1 <> value_of_previous(column_name1) >   then column_name1 end as column >     ,column_name2 > from table > ordered by column_name1, column_name2 Okay, with this table: test=# select * f

Re: [GENERAL] Statement Triggers

2010-03-10 Thread A. Kretschmer
In response to Gordan Bobic : > Specifically, what features of the SQL statement that triggered the event > are available to the function invoked by the trigger? Say I wanted to write http://www.postgresql.org/docs/8.4/interactive/plpgsql-trigger.html Except for NEW and OLD. > all INSERT statem

Re: [GENERAL] Finding duplicates only.

2010-03-10 Thread A. Kretschmer
In response to Greenhorn : > Hi, > > Can someone please help me with this duplicate query. > > I'm trying to: > > 1. Return duplicates only. (without including the first valid record), and I will try to help you. Assuming this table: test=*# select * from greenhorn order by id; id | ins

Re: [GENERAL] to_timestamp() and quarters

2010-03-02 Thread A. Kretschmer
In response to Tom Lane : > Asher Hoskins writes: > > I can't seem to get to_timestamp() or to_date() to work with quarters, > > The source code says > > * We ignore Q when converting to date because it is not > * normative. > * >

Re: [GENERAL] current transaction id

2010-03-01 Thread A. Kretschmer
In response to AI Rumman : > How to find the current transaction id of the database? select txid_current() Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99 -- Sent via pgsq

Re: [GENERAL] Two Versions of PostgreSQL Installed - How to uninstall one particular version

2010-02-25 Thread A. Kretschmer
In response to Wang, Mary Y : > Thanks Andreas for the info. I'm working on a development server right now, > and currently I don't have any data loaded yet. As matter of fact, I was > trying to load the database data from a dump file that generated by > "pg_dump". > Here is the thing: > I'v

Re: [GENERAL] Two Versions of PostgreSQL Installed - How to uninstall one particular version

2010-02-25 Thread A. Kretschmer
In response to Wang, Mary Y : > Hi, > > I got this error: > "-bash-2.05b$ /usr/local/pgsql/bin/pg_ctl start > server starting > -bash-2.05b$ FATAL: database files are incompatible with server > DETAIL: The data directory was initialized by PostgreSQL version 7.3, which > is not compatible with

Re: [GENERAL] Global Temp Table

2010-02-25 Thread A. Kretschmer
In response to Shameem Ahamed : > Hi, > > I want to create a global temp table in database, which can be > accessed from any session to the database. Is it possible ?. No. > > I tried with create global temp table , but the table created exist > only in that specific session. No other session i

Re: [GENERAL] PostgreSQL install fails with 1603 error

2010-02-24 Thread A. Kretschmer
In response to Mitesh Patel : > PostgreSQL version: 8.2.15 > Operating system: Windows 2003 > > PostgreSQL 8.2 install fails with exit code 1603. > > Any idea?? what could be wrong. I am running install from console. I mean no > RDP and using administrator AD account. I can't help you, i'm not

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread A. Kretschmer
In response to A. Kretschmer : > In response to Thom Brown : > > On 23 February 2010 13:43, Stefan Schwarzer > > wrote: > > >>>> Select countries.name, basel.year, basel.value, cites.year, cites.value > > >>>> From countries > > >>&g

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread A. Kretschmer
In response to Thom Brown : > On 23 February 2010 13:43, Stefan Schwarzer > wrote: > Select countries.name, basel.year, basel.value, cites.year, cites.value > From countries > Left Join basel on basel.id_country = countries.id_country and > basel.value=1 > Left Join cites

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread A. Kretschmer
In response to Stefan Schwarzer : > >You may also wish to review Andreas' suggestions as they propose a > >more sensible table structure rather than having a table for each > >convention. > > The table proposal really looks nice. But our database is structured > by variable - so each convention

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread A. Kretschmer
In response to Stefan Schwarzer : > Hi there, > > gush, shouldn't be that complicated. But neither in Postgres, nor in Access I > succeed in getting the result I wish. > > I have a couple of times for the Environmental Conventions (Kyoto, Montreal, > CITES etc.). They look like this: > > id_coun

Re: [GENERAL] about effective_cache_size

2010-02-18 Thread A. Kretschmer
In response to AI Rumman : > * What is the difference between shared_buffers and effective_cache_size? effective_cache_size: Sets the planner's assumption about the effective size of the disk cache that is available to a single query. This parameter has no effect on the size of shared memory alloc

Re: [GENERAL] Postgres physical directory structure meaning

2010-02-15 Thread A. Kretschmer
In response to S Arvind : > I want to know about the meaning of various directory present in data folder. > Mostly what will the 'base' folder contains? The reason of this is recently in > the datafolder 'global' was deleted unknowingly which leads to entire DB crash > in a second. We found a tool

[GENERAL] possible bug with inheritance?

2010-02-12 Thread A. Kretschmer
Hi, Our documentation says: "All check constraints and not-null constraints on a parent table are automatically inherited by its children." Okay, this works as expected: test=# create table parent (name text primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "parent_pke

Re: [GENERAL] Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?

2010-02-12 Thread A. Kretschmer
In response to Davor J. : > What I want is something similar to this: > > > Basically, what I want is a similar function f() that returns me a "pointer" > to the table which I can use in some query like this: SELECT * FROM > regclass(f()); Currently, this query only gives me one row 'tbl_temp'.

Re: [GENERAL] Postgres Triggers issue

2010-02-11 Thread A. Kretschmer
In response to Igor Neyman : > > > > CREATE TRIGGER tafter > > AFTER INSERT OR UPDATE > > ON r.m_a > > FOR EACH ROW > > EXECUTE PROCEDURE r.m_t(); > > > > > > Trigger function for an insert/update trigger should return "NEW", not > NULL (OLD - for "on delete" trigger): It's an AFTER TRIGGER, s

Re: [GENERAL] trouble with unique constraint

2010-02-11 Thread A. Kretschmer
In response to Khin, Gerald : > The following SQL leads to a unique constraint violation error message You have already got the answer ... for the same question from you. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006

Re: [GENERAL] PostgreSQL Installation

2010-02-11 Thread A. Kretschmer
In response to db.subscripti...@shepherdhill.biz : > Hi, > > Please why is it that we must register at EnterpriseDB and register > each Windows installation of postgreSQL these days? That's not true. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: ->

Re: [GENERAL] migrating data from 8.4 to 8.3

2010-02-11 Thread A. Kretschmer
In response to Thomas Kellerer : > Marc Lustig, 08.02.2010 11:36: > >Hi, can we safely put the data from /var/lib/postgresql/8.4/main/ of > >server x to /var/lib/postgresql/8.3/main/ of server y, considering > >that the new target machine is running 8.3 whereas the old one ran > >8.4 ? > > No, a d

Re: [GENERAL] migrating data from 8.4 to 8.3

2010-02-11 Thread A. Kretschmer
In response to Marc Lustig : > Hi, > can we safely put the data from /var/lib/postgresql/8.4/main/ of server x to > /var/lib/postgresql/8.3/main/ of server y, considering that the new target > machine is running 8.3 whereas the old one ran 8.4 ? No! Make a regular Backup und restore that Backup

Re: [GENERAL] trouble with unique constraint

2010-02-11 Thread A. Kretschmer
In response to Khin, Gerald : > The following SQL leads to a unique constraint violation error message > (PostgreSQL 8.4.1). > > > > > > create table test (val integer); > > > > create unique index test_uni on test(val); > > > > insert into test (val) values (1); > > insert into tes

Re: [GENERAL] PHP and PostgreSQL boolean data type

2010-02-10 Thread A. Kretschmer
In response to Thom Brown : > Hi, > > A long-standing problem we've had with PostgreSQL queries in PHP is > that the returned data for boolean columns is the string 'f' instead > of the native boolean value of false. http://andreas.scherbaum.la/blog/archives/302-BOOLEAN-datatype-with-PHP-compatib

Re: [GENERAL] 8.5devel: unexpected and illogical error during transaction, but transaction don't rolled back

2010-02-10 Thread A. Kretschmer
In response to Greg Stark : > On Wed, Feb 10, 2010 at 6:59 AM, A. Kretschmer > wrote: > > test=*# analyse table_a; > > ERROR:  canceling autovacuum task > > CONTEXT:  automatic vacuum of table "test.public.table_a" > > ANALYZE > > Time: 1235,600 ms &g

[GENERAL] 8.5devel: unexpected and illogical error during transaction, but transaction don't rolled back

2010-02-09 Thread A. Kretschmer
Hi all, I'm playing with 8.5devel aka 9.0 and got that: test=# with a as (insert into table_a select s, md5(s::text) from generate_series(0,25) s returning *), b as (insert into table_b select id, md5(value) from a where substring(value,1,1) between '0' and '9') sel

Re: [GENERAL] How do I drop a CONSTRAINT TRIGGER?

2010-02-08 Thread A. Kretschmer
In response to Wang, Mary Y : > Hi, > > How do I drop a CONSTRAINT TRIGGER? Just with DROP TRIGGER: test=# create table foo(a int); CREATE TABLE test=*# create function foo_proc() returns trigger as $$begin return new; end; $$ language plpgsql; CREATE FUNCTION test=*# create constraint trigger

Re: [GENERAL] Postgres wal shipping from 8.33 to 8.42.

2010-02-04 Thread A. Kretschmer
In response to Chris Barnes : > We are trying to minimize our downtime in production to upgrade from 8.33 to > 8.42. > > What we would like to be able to do is this: > Upgrade the slave we are currently shipping to, to version 8.4.2. Continue to > pitr to this server. And switch over and then upg

Re: [GENERAL] Output float number with hex format

2010-01-28 Thread A. Kretschmer
estion sould be about a scanf, not printf, as this is > input, not output. I think, you have misinterpreted the question, he is looking for a output in a hex representation, and he found a way for input. Hrm, i think, this is possible with pl/perl. For instance. A. Kretschmer -- Andreas K

Re: [GENERAL] Correct Concept On Table Partition

2010-01-26 Thread A. Kretschmer
In response to Yan Cheng Cheok : > Currently, I plan to use table partition to solve the following problem. > I have a table which is going to grow to a very huge row, as time goes on. > As I know, as table grow larger, the read operation will be slower. > > Hence, I decide to use table partition,

Re: [GENERAL] Log full of: statement_timeout out of the valid range.

2010-01-25 Thread A. Kretschmer
In response to Abraham, Danny : > Our setup is a real valid one. Looks like it has to do more with remote > connections. No. 'statement_timeout out of the valid range' has nothing to do with remote connections. > > Any idea? Show us your statement_timeout - setting. If you work with psql, just

  1   2   3   4   5   6   7   8   >