Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Albe Laurenz
Milan Zamazal wrote: > My problem is that retrieving sorted data from large tables > is sometimes > very slow in PostgreSQL (8.4.1, FWIW). > > I typically retrieve the data using cursors, to display them in UI: > > BEGIN; > DECLARE ... SELECT ... ORDER BY ...; > FETCH ...; > ... > > On

Re: [GENERAL] Some issues about data type convert

2010-01-04 Thread Albe Laurenz
donniehan wrote: > I have a question about pg_cast--- data type convert. > Pg provide more data types than sql spec, such as OID. > Internal OID type is unsigned int32 and INT8 is int64. > > Why pg can convert INT8 into OID implicitly while can not > convert OID into INT8 implicitly?

Re: [GENERAL] why non-greedy modifier for one atom changesgreediness of other atoms?

2010-01-04 Thread Albe Laurenz
hubert depesz lubaczewski wrote: >> Example: >> # select x, substring( x from E'^((.*?)(\\.[0-9]+))') from >( values ('ab.123xxx.46hfd'),('a.b.c.d.123xx')) as q (x); >> x| substring >> -+--- >> ab.123xxx.46hfd | ab.1 >> a.b.c.d.123xx | a.b.c.d.1 >> (2 ro

Re: [GENERAL] SELECT does not find table created by itself

2010-01-04 Thread Albe Laurenz
Magnus Hagander wrote: > > select * FROM (select 1 as a) t2 left join t2 t3 ON TRUE > > causes error > > ERROR:  relation "t2" does not exist > Not entirely sure if this is what you're looking for, but I think a > CTE can solve your problem: > WITH t2 AS (SELECT 1 AS a) > SELECT * FROM t2 LEFT JOI

Re: [GENERAL] postgresql/postgis installation

2009-12-31 Thread Albe Laurenz
Nick wrote: > Trying to install postgis on LINUX machine [...] > > during ./configure of postGIS errors out looking for geos-config > > during ./configure of geos errors out looking for g++ > > to the best of my knowledge g++ is part of gcc and we have a current > version of the gcc compiler on

Re: [GENERAL] esql vs libpq

2009-12-30 Thread Albe Laurenz
svcntk wrote: > ESQL = ECPG (Embedded SQL in C) > >>> I'm doing a comparison between ESQL interfaces and libpq. For libp I >>> use pgbench, based on TCP-C, while for ESQL have a program that also >>> follows the transactions carried out on TCP-C. >>> >>> However, the result with libpq is much bett

Re: [GENERAL] esql vs libpq

2009-12-30 Thread Albe Laurenz
svcntk wrote: > I'm doing a comparison between ESQL interfaces and libpq. For libp I > use pgbench, based on TCP-C, while for ESQL have a program that also > follows the transactions carried out on TCP-C. > > However, the result with libpq is much better, with about 700 > transactions per second,

Re: [GENERAL] dbi-link with Sybase

2009-12-26 Thread Albe Laurenz
> This may not be the best list for my question, but I'm sure someone there > will he able to help me There's a mailing list dedicated to DBI-Link, see http://lists.pgfoundry.org/mailman/listinfo/dbi-link-general > I'm trying to use dbi-link under RHEL5.3. Using PostgreSQL and Perl rpms from

Re: [GENERAL] WARNING: nonstandard use of escape in a string literal

2009-12-24 Thread Albe Laurenz
Patrick M. Rutkowski wrote: > Is the query > UPDATE my_table SET colname = NULL WHERE colname ~ '^\s*$' > > already all correct and standard conforming. Such that all I need to > do is turn on standard_conforming_strings to have it stop complaining > at me? Precisely. > In other words: I'm alrea

Re: [GENERAL] Error starting backup

2009-12-22 Thread Albe Laurenz
> A customer of mine is running 8.3.8. We are attempting to > take a backup, but whenever we issue pg_start_backup() it > always says that we need to first run pg_stop_backup() - Even > when I run the stop backup command right before trying to > start the backup. I have restarted PostgreSQL a

Re: [GENERAL] PostgreSQL and character set change

2009-12-22 Thread Albe Laurenz
Jayadevan M wrote: > We have a PostgreSQL server with ASCII data. We have a > requirement for the db to support UTF also. Which is the best > approach - > 1) Make a new installation, move data This is the only and hence the best approach. It doesn't have to be a new installation, a new databa

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-22 Thread Albe Laurenz
Durumdara wrote: [client_encoding is switched to WIN1250] > And what happening what DB recognize not win1250 character in SQL? > Is it converted to "?" or an exception dropped? > And if the UTF db contains non win1250 character? > Is it replaced in result with "?" or some exception dropped? What y

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-21 Thread Albe Laurenz
Durumdara wrote: >> - Change the client encoding to WIN1250 (e.g. by >> setting the environment variable PGCLIENTENCODING). > > So if I have Python and pygresql, can I set this value in Python? > The main problem that I don't want to set this value globally > - possible another applications want

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-20 Thread Albe Laurenz
You are confusing a few things, and you don't want to hear the explanations because they are inconvenient. Andrus wrote: > 1. In my case b expression needs values from previous rows updated in this > same command before: You are confusing "to the left of" and "before". If you want behaviour that

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-20 Thread Albe Laurenz
JGuillaume (ioguix) de Rorthais wrote: >> I am currently developing such a beast, it is currently still quite >> alpha. If you are interested I can send you a copy. I'll try to >> publish it once it is sufficiently beta. > > Interesting project, but but I have one big issue under 8.1 and > advanced

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Albe Laurenz
Chris Ernst wrote: > I have a project where I need to be able to capture every query from a > production system into a file such that I can "replay" them on a staging > system. Does such a thing already exist or should I start writing my > own log parser? I am currently developing such a beast, i

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-19 Thread Albe Laurenz
Durumdara wrote: > I have a software that uses Postgresql. This program (and website) developed > and working on Window (XP/2003), > with native charset (win1250). > > Prior week we got a special request to install this software to a Linux > server. > > Yesterday I installed Ubu9.10 on VirtualBox

Re: [GENERAL] quote string exactly as it is

2009-12-02 Thread Albe Laurenz
dario.ber wrote: > How can I quote a string *exactly* as it is? I tried using > quote_literal() but it doesn't return what I need in some cases. > > E.g. > > If my > string is: ss\\\ss > > And I do: > > select quote_literal('ss\\\ss'); > > I get: > > > E'ss\\ss' <-- My string now has E''

Re: [GENERAL] what did happen to dblink_ora

2009-12-01 Thread Albe Laurenz
Harald Armin Massa wrote: > in 2003 there was a thread started by Hans about dblink_ora... > http://archives.postgresql.org/pgsql-hackers/2003-06/msg00361.php > it "ends" with something about "propably not ready for 7.4". > There was the proposal to integrate it within the normal dblink. > Did hap

Re: [GENERAL] DBD::Pg 2.15.1 compilation failed

2009-11-24 Thread Albe Laurenz
Alexandra Roy wrote: > => I thought that I was using perl 64-bit but it was not the case :-( > > All the builts I did, for DBI, DBD::Oracle, etc..., have been done with > perl 32-bits... > But Oracle is 64 bit and PostgreSQL 8.3.8 has been built in 64 bit too. If you install 64-bit Oracle (in fa

Re: [GENERAL] DBD::Pg 2.15.1 compilation failed

2009-11-24 Thread Albe Laurenz
Alexandra Roy wrote: > > I am still trying to build DBD::Pg but I have another question. > > Is it possible to do a 64-build of DBD::Pg ? > I ask this because PostgreSQL 8.3.8 has been compiled in 64 bits mode > and if DBD::Pg expects to find 32 bits library, this can explain my > problem... I

Re: [GENERAL] Customize the install directory of the postgres DB

2009-11-13 Thread Albe Laurenz
weixiang tam wrote: > I am trying to install the postgres8.2.14 via the RPM; > however the install directory is default to the following folder > > > > * Executables : /usr/bin > * Libraries : /usr/lib > * Documentation : /usr/share/doc/postgresql-x.y.z , > /usr/share/doc/postgre

Re: [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-11 Thread Albe Laurenz
Alexandra Roy wrote: > Without the "-disable-largefile" option, the compilation is > still failing with this error: > > > In file included from psqlscan.c:2385: > /usr/include/unistd.h:171: error: conflicting types for 'lseek64' > /usr/include/unistd.h:169: error: previ

Re: [HACKERS] [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-11 Thread Albe Laurenz
Tom Lane wrote: >> The problem is that both _LARGE_FILES and _LARGE_FILE_API are #defined >> in this case, which makes #include fail. >> Does anyone have an idea how to best fix this problem in the >> source tree? I'm willing to implement and test. > > I've committed changes for this in CVS, plea

Re: [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-10 Thread Albe Laurenz
I CC: this to the hackers list as it seems to be an old problem that was never fixed. See at the bottom. Alexandra Roy wrote: > This is a summary of what I have noticed concerning > PostgreSQL 8.3.8 compilation on AIX 5.3 TL9. > > 1. To do a successful 64-bit build, specify and execute: > > >

Re: [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-10 Thread Albe Laurenz
Alexandra Roy wrote: > I have always run "gmake distclean" before relaunching a build. > > Maybe the32-bit build failed because I have not set and exported the > "OBJECT_MODE" environment variable. > I will try to build PostgreSQL once again with "export > OBJECT_MODE=32". I will look at the 32

Re: [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-09 Thread Albe Laurenz
Alexandra Roy wrote: > It was a 32-bit build as I didn't have set the "OBJECT_MODE" to 64. > I call configure and make using as root user: > > # ./configure > # gmake > > The releases of "make" and "gcc" are : > make-3.80-1 > gcc-4.2.0-3 Hmmm, I dont get the error if I set OBJECT_MODE to

Re: [GENERAL] PostgreSQL 8.3.8 on AIX5.3 : compilation failed

2009-11-09 Thread Albe Laurenz
> I am trying to compile PostgreSQL 8.3.8 on AIX 5.3 TL9 (64 bits). > The ".configure" has been executed with success without any > error but the compilation of PostgreSQL with "gmake" fails. > > Please find below the errors I get : > > > In file included from psqlscan.c:2385: > /

Re: [GENERAL] pg_start_backup question

2009-11-02 Thread Albe Laurenz
db de wrote: > Below is what I did: > I opened a super user connection to creat a super user > statement. Then use the super user statement to execute > "SELECT pg_start_backup('label')". > > try > { > superuserCont = java.sql.DriverManager.getConnection(URL, su, > suPassword); >

Re: [GENERAL] Implementing Frontend/Backend Protocol TCP/IP

2009-10-27 Thread Albe Laurenz
John R Pierce wrote: > yah, seriously. the binary protocol is not considered stable, it can > change in subtle ways in each version. libpq handles the current > version and all previous versions, and exposes all methods. That's probably not the problem in the original message, but there are t

Re: [GENERAL] pgadmin3 hangs during dump

2009-10-19 Thread Albe Laurenz
Dennis Gearon wrote: > I set up the same characteristics on the console, and it runs > fine, (COPY commands will import back, right? That's what it output.) > > On the console, it was: > pg_dump -vaF p -f dbase.sql -U user-name dbase-name > > More details: > about 11 tables, practically emp

Re: [GENERAL] how to Export ALL plpgsql functions/triggers to file

2009-10-15 Thread Albe Laurenz
Naoko Reeves wrote: > Could you tell me how to Export ALL plpgsql > functions/triggers to file? I'd do it as follows: - Perform a pg_dump of the database object definitions: pg_dump -F c -s -f database.dmp database - Create a listing, delete everything except triggers and functions: pg_rest

Re: [GENERAL] different sort order for primary key index

2009-10-14 Thread Albe Laurenz
Paul Hartley wrote: > I have a composite primary key for a table, let's call it > (col1, col2). When this table is created, obviously an > implicit index is created for this key. I would like the > sort order of this index to be different for the two columns > -- if I were to create the index

Re: [GENERAL] Documentation on standard conforming strings?

2009-10-06 Thread Albe Laurenz
Preston de Guise wrote: > I don't yet properly understand the conforming strings implementation > that came in 8.3 The manual (to me at least) has been a little > imprecise in describing the implications for correctly inserting data > with this enabled without getting back a plethora of warnings

Re: [GENERAL] Where can I find detail information about constraint ?

2009-09-23 Thread Albe Laurenz
??? wrote: > I want detail usage introduction about constraint,such as how > to constrain a string to be exactly 4 character and start with 'z'. > Where can I find the reference of CHECK? detail usage. Documentation: http://www.postgresql.org/docs/current/static/ddl-constraints.html#AEN2254 The

Re: [GENERAL] Substitutes for some Oracle packages

2009-09-18 Thread Albe Laurenz
Sandra Arnold wrote: > We are in the process of migrating from Oracle to PostgreSQL. > One of the things that we are needing to find out is what to > use in place of Oracle supplied functionality such as > "DBMS_OUTPUT" and "UTL_FILE". We are currently using this > type of functionality in St

Re: [GENERAL] invalid byte sequence for encoding

2009-09-16 Thread Albe Laurenz
Daniel Schuchardt wrote: > but look here: > > X=# UPDATE art SET ak_auftxt= '*', ak_auftxt_rtf= > '{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 > Arial;}}\r\n\\viewkind4\\uc1\\pard\\lang1031\\fs20 * > \r\n\\par }\r\n\0' WHERE ak_nr='TEST'; > WARNING: nonstandard use of \\ in a strin

Re: [GENERAL] Getting Out Parameter in the application using libpq

2009-09-14 Thread Albe Laurenz
Ehsan Haq wrote: >I still don't get. How can I get the varchar OUT parameter > in the application? For Example > > CREATE OR REPLACE > Function getOutVarchar(outvarchar OUT varchar2) RETURN NUMBER > IS > BEGIN >outvarchar:='This is Out String'; >RETURN 1; > END getOutVarchar; > > iri

Re: [GENERAL] PQgetlength vs. octet_length()

2009-08-19 Thread Albe Laurenz
Michael Clark wrote: > That is what Pierre pointed out, and you are both right. I > am using the text mode. > > But it seems pretty crazy that a 140meg bit of data goes to > 1.3 gigs. Does that seem a bit excessive? > > I avoided the binary mode because that seemed to be rather > confusing w

Re: [GENERAL] Database Security

2009-08-17 Thread Albe Laurenz
Kalai R wrote: > i am near to PostgreSql. I create a database by the > superuser. Then i create another logon user. Now how can i > protect my database from the new user. i want to ban the > access and view the database to the new user.It can done by > an entry in pg_hba file. Is there any oth

Re: [GENERAL] 8.4.0 bug - failure to enforce a foreign key constraint

2009-08-13 Thread Albe Laurenz
Radoslaw Zielinski wrote: > radek=# \d kandydaci > Table "public.kandydaci" > Column | Type | Modifiers > ---+--+--- >id_rekordu| bigint | not null >id_osoby | integer | n

Re: [GENERAL] pg_stat_activity undocumented?

2009-07-30 Thread Albe Laurenz
Thomas Kellerer wrote: > is there a reason why pg_stat_activity is not documented in > the chapter "System Catalogs"? > > Is this not a "offical" view? I guess it is because they are documented in http://www.postgresql.org/docs/8.4/static/monitoring-stats.html#MONITORING-STATS-VIEWS-TABLE in Ch

Re: [GENERAL] Clients disconnect but query still runs

2009-07-29 Thread Albe Laurenz
Robert James wrote: > Is there no way to have the OS interrupt the postgres process > when a TCP/IP disconnect happens? Or is the OS also in the > dark that the TCP/IP connection was dropped? I believe that > there is a way to monitor this using TCP/IP keep alives. > Or perhaps Postgres could ch

Re: [GENERAL] count of query results in for loop

2009-07-28 Thread Albe Laurenz
Sim Zacks wrote: > Is there any way to (without a separate count query first) to know the > number of rows returned in a: > > for x in select ... Loop > > ... > > End Loop > > structure? No. Not before you exit the loop. Yours, Laurenz Albe -- Sent via pgsql-general mailing list

Re: [GENERAL] C Function Question

2009-07-28 Thread Albe Laurenz
Terry Lee Tucker wrote: > Does anyone know if a function written in C and linked into the backend in a > shared library with a statically declared structure, maintain that data for > the life of the backend process such that, when the function is called again, > the structure data is intact? >

Re: [GENERAL] Server/Client Encoding Errors

2009-07-27 Thread Albe Laurenz
APseudoUtopia wrote: > I'm having some problems when inserting special characters into a > column. Here's the table: > > -- > Table "public.users_history_ip" >Column |Type |

Re: [GENERAL] Converting SQL to pg

2009-07-24 Thread Albe Laurenz
martin wrote: > I must be tired. Any suggestions on converting the following > to postgresql? > > UPDATE IGNORE yose5_user_newflags AS flags, yose5_messages AS > msg SET flags.forum_id = msg.forum_id WHERE flags.message_id = > msg.message_id AND flags.message_id IN (15580, 15581, 15706, > 15712,

Re: [GENERAL] ECPG Deallocate PREPARE statement - bug ?

2009-07-24 Thread Albe Laurenz
l...@crysberg.dk wrote: >I have a program that I need compile using PostgreSQL > 8.4.0 (or later) and it must be able to run on an 8.3.5 based > system as well as 8.4.0. I'm using embedded SQL for C and I > have the following sequence of statements: > >snprintf( stmt, 3000, "SELECT coun

Re: [GENERAL] Search Path vs Synonyms

2009-07-23 Thread Albe Laurenz
Matthew Seaborn wrote: > Given the situation where a user connecting to the database > needs access to two separate schemas: the primary schema > which contains the data they will be updating and a second > schema which contains read-only reference data, used by many > users, that will be using

Re: [GENERAL] enabling join_collapse_limit for a single query only

2009-07-23 Thread Albe Laurenz
groovefillet wrote: > Is it possible to set the runtime parameter 'join_collapse_limit' for > a single query only without setting/unsetting it before/after? Yes: START TRANSACTION; SET LOCAL join_collapse_limit = 42; SELECT . COMMIT; Yours, Laurenz Albe -- Sent via pgsql-general maili

Re: [GENERAL] table.column in query results?

2009-07-23 Thread Albe Laurenz
Andrew Klaassen wrote: > Is it possible to get table.column in query results rather > than just column? > > I.e. I'd like: > > SELECT * FROM foo, bar; > foo.id | foo.name | bar.id | bar.text > ---+--++- > ... > > ...rather than: > > SELECT * FROM foo, bar; > id | na

Re: [GENERAL] Best practices for moving UTF8 databases

2009-07-21 Thread Albe Laurenz
Phoenix Kiula wrote: > > I wonder: why do you spend so much time complaining instead of > > simply locating the buggy data and fixing them? > > > I'd love to fix them. But if I do a search for > > SELECT * FROM xyz WHERE col like '%0x80%' > > it doesn't work. How should I search for these chara

Re: [GENERAL] Working around spurious unique constraint errors due to SERIALIZABLE bug

2009-07-20 Thread Albe Laurenz
Craig Ringer wrote: > > The drawback is that some of the side effects of the INSERT occur > > before the constraint check fails, so it seems to me that I still need > > to perform the select. > > If you really can't afford the INSERT side effects and can't redesign > your code to be tolerant of th

Re: [GENERAL] Best practices for moving UTF8 databases

2009-07-20 Thread Albe Laurenz
Phoenix Kiula wrote: > Really, PG absolutely needs a way to upgrade the database without so > much data related downtime and all these silly woes. Several competing > database systems are a cinch to upgrade. I'd call it data corruption, not a silly woe. I know that Oracle for example would not ma

Re: [GENERAL] Working around spurious unique constraint errors due to SERIALIZABLE bug

2009-07-16 Thread Albe Laurenz
Florian Weimer wrote: > SERIALIZABLE isolation level doesn't really conform to the spec > because it doesn't deal with phantoms. The only case I've come across > where this actually matters is when you're implementing some sort of > "insert into table if not yet present" operation. This will typi

Re: [GENERAL] [PERFORM] Concurrency issue under very heay loads

2009-07-16 Thread Albe Laurenz
Raji Sridar wrote: > We use a typical counter within a transaction to generate > order sequence number and update the next sequence number. > This is a simple next counter - nothing fancy about it. When > multiple clients are concurrently accessing this table and > updating it, under extermely

Re: [GENERAL] Best practices for moving UTF8 databases

2009-07-13 Thread Albe Laurenz
Phoenix Kiula wrote: > Hi. I *always* get an error moving my current fully utf-8 database > data into a new DB. > > My server has the version 8.3 with a five year old DB. Everything, all > collation, LC_LOCALE etc are all utf8. > > When I install a new Postgresql 8.4 on my home Mac OSX machine (a

Re: [GENERAL] Design question: Should "postgres" own all the db objects?

2009-07-13 Thread Albe Laurenz
Andreas wrote: > who should own the db objects? > I once read one should not let postgres or any other superuser own the > tables and what not. > Instead one should better create a separate user role with little > privileges to be the owner. > I'm not quite sure why this was abvised. Maybe like n

Re: [GENERAL] sslv3 alert illegal parameter

2009-07-08 Thread Albe Laurenz
Pedro Doria Meunier wrote: > My server started spitting this out every second! > > LOG: could not accept SSL connection: sslv3 alert illegal parameter > > "PostgreSQL 8.3.7 on x86_64-redhat-linux-gnu, compiled by GCC gcc > (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)" > > Server key in place.. > >

Re: [GENERAL] Bug in ecpg lib ?

2009-07-08 Thread Albe Laurenz
l...@crysberg.dk wrote: > I have been trying to figure this thing out myself too, > breakpointing and single stepping my way through some of the > ecpg code, but without much clarification. (More that I > learned new things about pthread). I have been trying to > figure out whether this is

Re: [GENERAL] Bug in ecpg lib ?

2009-07-08 Thread Albe Laurenz
I wrote: > What I notice about your program is that you connect to the database > in the main thread, then start a new thread and use the connection in that > new thread. > > I don't know, but I'd expect that since ecpg keeps a thread-specific > sqlca, this could cause problems. Indeed I find wit

Re: [GENERAL] Bug in ecpg lib ?

2009-07-07 Thread Albe Laurenz
l...@crysberg.dk wrote: >I have now generate a rather small example where I > experience the problem, attached. It is linked with the > mudflapth library using the commands below. You may have to > change the DBNAME and DBUSER. The delay just before the > pthread_cancel(), i.e. sleep(10), i

Re: [GENERAL] An example needed for Serializable conflict...

2009-07-07 Thread Albe Laurenz
Durumdara wrote: > Please send me an example (pseudo-code) for Serializable conflict. > And I wanna know, if possible, that if more transactions only > read the tables in Serializable mode, and one or others write > to it, can I got some conflicts in read operation? You get a serialization confl

Re: [GENERAL] Efficiently move data from one table to another, with FK constraints?

2009-07-07 Thread Albe Laurenz
Rob W wrote: > I am using COPY to bulk load large volumes (i.e. multi GB > range) of data to a staging table in a PostgreSQL 8.3. For > performance, the staging table has no constraints, no primary > key, etc. I want to move that data into the "real" tables, > but need some advice on how to do

Re: [GENERAL] Normalize INTERVAL ouput format in a db driver

2009-07-07 Thread Albe Laurenz
Sebastien FLAESCH wrote: > According to the doc, INTERVAL output format is controlled by > SET intervalstyle. > > I am writing an interface/driver and need a solution to > fetch/convert interval > values independently from the current format settings... > > I could force my driver to implicitly

Re: [GENERAL] High consumns memory

2009-07-01 Thread Albe Laurenz
Anderson Valadares wrote: [this is on Windows, DB is accessed with ODBC driver 8.4.3] > Thanks for the answer ... > > But honestly I think that was a misunderstood. > > > > The memory increase issue is showed in the DATA column. > > Look how day by day it increases exponencially. > > In

Re: [GENERAL] Unexpected behaviour of date_part

2009-06-30 Thread Albe Laurenz
Richard Huxton wrote: > > test=> SELECT date_part('timezone_hours', timestamp with time zone > > '2009-06-26 10:05:57.46624+11'); > > date_part > > --- > > 2 > > (1 row) > > > > 2 being the offset of my local time zone. > > > > Now an EXPLAIN shows that this is due to the fact

[GENERAL] Unexpected behaviour of date_part

2009-06-29 Thread Albe Laurenz
This is PostgreSQL 8.4, but the behaviour has not changed from earlier versions: test=> SHOW timezone; TimeZone --- Europe/Vienna (1 row) test=> SELECT date_part('timezone_hours', timestamp with time zone '2009-06-26 10:05:57.46624+11'); date_part --- 2 (1

Re: [GENERAL] Bug in ecpg lib ?

2009-06-25 Thread Albe Laurenz
l...@crysberg.dk wrote: >I'm using PostgreSQL in a server project that uses many > forks and many threads in each forked process. > >Almost everytime I do a pthread_cancel() I get a SIGSEGV. > I have then linked the libmudflapth into my program to catch > the problem sooner and now that

Re: [GENERAL] example of aggregate function for product

2009-06-25 Thread Albe Laurenz
Whit Armstrong wrote: > I needed to write a product aggregate function, and just happened to > find this example in the nodes to the 8.0 manual: > [...] > > but that example looks pretty different than the ones found in the 8.3 > manual (avg for instance): > [...] > > Are there any experts out

Re: [GENERAL] JDBC prepared statements & server-side prepared statements

2009-06-25 Thread Albe Laurenz
Jack Orenstein wrote: > I'm using postgresql 8.3.7. Under what conditions does a JDBC prepared > statement > result in a server-side prepared statement? http://jdbc.postgresql.org/development/privateapi/org/postgresql/PGStatement.html#setPrepareThreshold(int) The default is 5, as far as I remem

Re: [GENERAL] [BUGS] Integrity check

2009-06-24 Thread Albe Laurenz
David Fetter wrote: > > Please can you assist on following questions. > > This is an issue for pgsql-general, where I'm redirecting this. > > > > * do you any tool to check postgreSQL database integrity check? > > No more than Oracle does. We get it right in the first place. The > existence of

Re: [GENERAL] What's wrong with this query?

2009-06-22 Thread Albe Laurenz
Thomas Kellerer wrote: >> CREATE TABLE test >> ( >> value uuid >> ); >> >> INSERT INTO test VALUES ('----'); >> INSERT INTO test VALUES ('----'); >> INSERT INTO test VALUES (null); >> >> select * from test where value != '-

Re: [GENERAL] where is the table?

2009-06-22 Thread Albe Laurenz
sergio nogueira wrote: > dmonitor=> create table wereisthetable(col int); > CREATE TABLE > dmonitor=> select tablename, tablespace from pg_tables where > tablename='wereisthetable'; >tablename| tablespace > + > wereisthetable | > (1 row) > > dmonitor=> alter

Re: [GENERAL] Invalid statement name (null) in line ## - what am I doing wrong ?

2009-06-19 Thread Albe Laurenz
leif wrote: >Thank you for precise answer. And yes, I have (at least) 2 > connections, all named. So I am even not using the 'default' > connection prepared statement as you point out. > >I have looked a little further into the output of ecpg as > well as adding the "AT " to my statemen

Re: [GENERAL] Invalid statement name (null) in line ## - what am I doing wrong ?

2009-06-19 Thread Albe Laurenz
l...@crysberg.dk wrote: >I have a problem when upgrading from 8.2.4 to 8.3/8.4 using ecpg with a > prepare statement: > > EXEC SQL PREPARE execquery FROM :stmt; line = __LINE__; > EXEC SQL AT :_thisDbConn DECLARE execcurs CURSOR FOR execquery; line = > __LINE__; > EXEC SQL AT :_thisDbConn OP

Re: [GENERAL] Playing with set returning functions in SELECT list - behaviour intended?

2009-06-17 Thread Albe Laurenz
Tom Lane wrote: > It's always been that way. The lack of any obviously-sane way to > handle multiple SRFs in a targetlist is exactly why the feature is > looked on with disfavor. It is clear that there is no really good way to handle this. How about my last example that involved aggregate functi

[GENERAL] Playing with set returning functions in SELECT list - behaviour intended?

2009-06-16 Thread Albe Laurenz
While playing around with the new features in 8.4rc1, I observe the following: I create a simple set returning function: CREATE OR REPLACE FUNCTION n_plicate(x anyelement, i integer) RETURNS SETOF anyelement LANGUAGE plpgsql AS $$BEGIN FOR n IN 1..i LOOP RETURN NEXT x; END LOOP; R

Re: [GENERAL] How can I interpolate psql variables in function bodies?

2009-06-16 Thread Albe Laurenz
J. Greg Davidson wrote: > Hi dear colleagues, > > I'm trying to pull some platform-specific constants out of my > code by using psql variables, e.g.: > > $ psql -v TypeLength=4 > > # CREATE TYPE tref ( > INTERNALLENGTH = :TRefTypeLength, > INPUT = tref_in, > OUTPUT = tref_out, > PASSEDBY

Re: [GENERAL] Libpq on windows

2009-06-10 Thread Albe Laurenz
Phil wrote: > I want to develop an app which uses libpq, built with mingw. > Is there a download package which contains just the include files/dlls? > If not, what package do I download? I don't need the server, just the client > libraries. You can use the regular binary installer for Windows, it

Re: [GENERAL] Function: Change data while walking through records

2009-06-08 Thread Albe Laurenz
stevesub wrote: > I keep having this need to create a function that will change the row data > as I am walking through the data. For example, I process each row in order, > if column1 change from previous row, set column2 to true. > > Is this possible? I can run another query to modify the data,

Re: [GENERAL] invalid byte sequence for encoding "UTF8": 0xab

2009-06-08 Thread Albe Laurenz
Mark D. Grand wrote: > I am having a vexing problem with a script I am writing to > populate reference tables in a new database. > > I am running postgreSQL 8.3 with psql 8.3.7. > > Psql reads this SQL statement: > > INSERT INTO META_AUTH.DOMAIN_META_ASSERTION (TITLE, DESCRIPTION, > META_

Re: [GENERAL] PostgreSQL and XA Distributed Transaction Protocol

2009-06-08 Thread Albe Laurenz
Christian Ferrari wrote: > I'm developing a new, free, XA compliant transaction manager. > One of the first resource manager I would be glad to support > is PostgreSQL; after some googling I have found no > information related to PostgreSQL and XA protocol support. > Can anyone give me more infor

Re: [GENERAL] Server admin for Clients ?

2009-06-08 Thread Albe Laurenz
Dave Gauthier wrote: > What does Postgres have for managing/controlling user access > to the DB in terms of resource allocation? I remember in > Oracle, you could specify how many server slots were > available for users to share and how much resources they were > allotted. A super-user that n

Re: [GENERAL] trigger functions with arguments

2009-06-08 Thread Albe Laurenz
Kev wrote: > I came across this curious behaviour today, at least in the 2009-03-24 > beta (I can't run a newer beta), that I couldn't find in the docs, > although maybe I missed it. [...] > So while that is the way to create the trigger itself, the > trigger procedure must be created like this:

Re: [GENERAL] recursive execute

2009-06-05 Thread Albe Laurenz
Rastislav Hudak wrote: > I'd like to get an array containing distinct values (always > integers) form a column in a table that is provided as a > parameter. So I created this function: > > CREATE OR REPLACE FUNCTION get_distinct_values(table_name text, param_name > text) > RETURNS integer[] A

Re: [GENERAL] Postgres registry access using java

2009-05-28 Thread Albe Laurenz
Anirban Pal wrote: > In the pg_settings table, all reference to folder is with reference to data > directory. > No reference to postgres instalation > base directory, i mean where postgres have been installed. That's true, you won't find that in the database. Yurs, Laurenz Albe -- Sent via p

Re: [GENERAL] Postgres registry access using java

2009-05-28 Thread Albe Laurenz
Anirban Pal wrote: > 1st of all thanks for your kind reply. But I can access registry values > using java. Ok, then you have some additional native code installed :^) Does the documentation of this add-on suggest a way to search and traverse Windoes registry keys? >> Can any body tell me how

Re: [GENERAL] Postgres registry access using java

2009-05-28 Thread Albe Laurenz
Anirban Pal wrote: > Can any body tell me how to fetch directory path for lib or > data directory for postgres installation in windows using > registry. Solution using Java language will be highly solicited. Java does not give you access to the Windows registry as this is not portable to other

Re: [GENERAL] How to restore a SQL-ASCII encoded database to a new UTF-8 db?

2009-05-21 Thread Albe Laurenz
> I have a database that was created with SQL-ASCII encoding > (unfortunately). I ran pg_restore to load the struct and data into a > new database with UTF-8 encoding but no surprise- I'm seeing this > error for a number of tables: > > pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte

Re: [GENERAL] Commit visibility guarantees

2009-05-19 Thread Albe Laurenz
Marsh Ray wrote: >>> The central question: So if I successfully commit an update >>> transaction on one connection, then instantaneously issue a select on >>> another previously-opened connection, under what circumstances am I >>> guaranteed that the select will see the effects of the update? >> >>

Re: [GENERAL] Need help

2009-05-18 Thread Albe Laurenz
Zico wrote: [wants to restore a database without a backup] >> Could you explain that in more detail? >> What is a pds or docs? > > PDF ==> Portable Document Format files > Docs ==> Documents > > Means, i have the backup of my files only which was in that database. I'm still not sure what that me

Re: [GENERAL] Need help

2009-05-18 Thread Albe Laurenz
Zico wrote: [wants to restore a database without a backup] >> Copy all the files that belong to the PostgreSQL server (everything >> under the data directory) to a working machine with PostgreSQL >> installed, and you should be able to start the server there. > > the problem is, i don`t have files

Re: [GENERAL] Need help

2009-05-18 Thread Albe Laurenz
Zico wrote: > our server suddenly went down and after searching, i found > out that, the OS crashed. So, i had to re-install my OS > again. But, the problem is, I couldnot take the dump file for > my postgresql database. Now, i have the raw data, that means, > my datas are in a disk. Is it possible

Re: [GENERAL] regexp_matches problem

2009-05-13 Thread Albe Laurenz
WP Perquin wrote: > When I make the following simplified example: > > SELECT regexp_matches('' > > ,'((title\s*=\s*\"([^"]*)")+)|((src\s*=\s*\"([^"]*)")+)','ig') > > My result are 2 rows: > > "{NULL,NULL,NULL,"src=\"\"","src=\"\"",}" > > "{"title=\"dit is een title tekst\"","title=

Re: [GENERAL] Selecting data from bytea field in 8.3

2009-05-12 Thread Albe Laurenz
Tomasz Rejman wrote: > Few days ago I have changed my postgreSQL to 8.3 version and I have problem > with bytea fields. Let me show you an example: > > CREATE TABLE testtable > ( > test bytea > ); > insert into testTable (test) VALUES > (E'\304\205\304\207\305\274\303\263\305\202wjfdsafdsa'); >

Re: [GENERAL] getting a list of users

2009-05-07 Thread Albe Laurenz
Eric Smith wrote: > How do I get a list of database usernames using the postgres C API? Execute this query: SELECT usename FROM pg_catalog.pg_user and read the results. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscri

Re: [GENERAL] Power outage and funny chars in the logs

2009-05-07 Thread Albe Laurenz
Glyn Astill wrote: > We had a power outage today when a couple of computer > controlled power strips crashed (my secondary psu's will stay > firmly in the wall sockets now though). > > I'd had a lot of fun pulling plugs out under load before we > went into production so I wasn't particularly wo

Re: [GENERAL] Transaction settings: nowait

2009-05-06 Thread Albe Laurenz
durumdara wrote: > In FireBird the transactions have these settings: > > > SET TRANSACTION >[NAME hostvar] >[READ WRITE | READ ONLY] >[ [ISOLATION LEVEL] { SNAPSHOT [TABLE STABILITY] > | READ COMMITTED [[NO] RECORD_VERSION] } ] >[WAIT | NO WAIT] >[LOCK

Re: [GENERAL] trouble with to_char('L')

2009-04-21 Thread Albe Laurenz
Mikko wrote: > my database has UTF8 encoding and Finnish locale, the client_encoding > and the console is set to WIN1252. I created a table with a single > NUMERIC(5,2) column and inserted a few values. Running a query 'SELECT > to_char(money, '999D99L') FROM table' through psql gives the following

<    4   5   6   7   8   9   10   11   12   13   >