[GENERAL] function in index expression and unnecessary function calls in select

2005-12-04 Thread Eugene Prokopiev
Hi, I have Linux, PostgreSQL 8.1, Python 2.3 pgsql code: test=# create table t1(name varchar(10), value integer); CREATE TABLE test=# create or replace function f1(integer) returns integer as $$ test$# file = open('/tmp/f1.log', 'a') test$# file.write('log\n') test$# file.close test$# return ar

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Anton Nikiforov
Tom Lane wrote: Anton Nikiforov <[EMAIL PROTECTED]> writes: is there any function that can translate INT to INET type? Nothing built-in, and given the fact that "inet" no longer means "IPv4", it's unlikely we'd add one in the future. But there's nothing stopping you from adding one of your

Re: [GENERAL] function in index expression and unnecessary function calls in select

2005-12-04 Thread Martijn van Oosterhout
On Sun, Dec 04, 2005 at 01:00:52PM +0300, Eugene Prokopiev wrote: > Hi, > > I have Linux, PostgreSQL 8.1, Python 2.3 > > test=# select name, f1(value) from t1; > name | f1 > --+ > r1 | 2 > r2 | 3 > (records: 2) > > $ cat /tmp/f1.log > log > log > log > log > log > log > > Wh

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Anton Nikiforov
Tom Lane wrote: Anton Nikiforov <[EMAIL PROTECTED]> writes: is there any function that can translate INT to INET type? Nothing built-in, and given the fact that "inet" no longer means "IPv4", it's unlikely we'd add one in the future. But there's nothing stopping you from adding one of your

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Martijn van Oosterhout
On Sun, Dec 04, 2005 at 02:09:53PM +0300, Anton Nikiforov wrote: > Sorry for my stupidity but, maybe there is a function that converts mask > stored in int format to a numer of bits? ;) > Your function easyly convert this mask to dot decimal notation, but how > to count the number of 1 in it? No

Re: [GENERAL] Unicode Corruption and upgrading to 8.0.4. to 8.1

2005-12-04 Thread Zlatko Matic
Have you tried to restore just schema first, then data? Greetings, Zlatko - Original Message - From: "Howard Cole" <[EMAIL PROTECTED]> To: "'PgSql General'" Sent: Friday, December 02, 2005 3:02 PM Subject: [GENERAL] Unicode Corruption and upgrading to 8.0.4. to 8.1 Hi everyone, I ha

[GENERAL] Fwd: Enhancement Request : Expressions for format string in PlPgsql RAISE statement

2005-12-04 Thread Laurent Herve
Hello there, Unfortunately, as I am not a C hacker, I won't be able to do that by myself. Do you think it is an interesting feature or not ? Is anybody else interested in it ? Should I send it to hackers list for TODO item creation request ? Thanks. -- Message transmis -- Sub

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Anton Nikiforov
Martijn van Oosterhout wrote: On Sun, Dec 04, 2005 at 02:09:53PM +0300, Anton Nikiforov wrote: Sorry for my stupidity but, maybe there is a function that converts mask stored in int format to a numer of bits? ;) Your function easyly convert this mask to dot decimal notation, but how to count

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Guido Neitzer
On 02.12.2005, at 20:02 Uhr, Jaime Casanova wrote: so the way to do it is create a trigger that record in a table the number of rows... As there are SO MANY questions about the "count(*)" issue, I wonder whether it makes sense to add a mechanism which does exactly the method mentioned abov

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Tino Wildenhain
Am Sonntag, den 04.12.2005, 14:02 +0100 schrieb Guido Neitzer: > On 02.12.2005, at 20:02 Uhr, Jaime Casanova wrote: > > > so the way to do it is create a trigger that record in a table the > > number of rows... > > As there are SO MANY questions about the "count(*)" issue, I wonder > whether it

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Martijn van Oosterhout
On Sun, Dec 04, 2005 at 03:21:47PM +0300, Anton Nikiforov wrote: > Martijn van Oosterhout wrote: > >Let i be your input. > >Calculate t = -i. > >If i is in the right format, t will have exactly one bit set. > >Test this with t <> 0 and (t & i) == t > >If that's ok, then your answer is 32 - log2(t)

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Bruno Wolff III
On Sun, Dec 04, 2005 at 14:40:49 +0100, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > > Doing something to enable aggregates in general to use > an existent index would be a nice ide imho. > (With all the visibility hinting in place) Assuming you are refering to max and min, this has already bee

Re: [GENERAL] Use of %ROWTYPE in plpgsql function declarations

2005-12-04 Thread Tom Lane
"Karl O. Pinc" <[EMAIL PROTECTED]> writes: > ... It just seemed a little wierd > not to have the %ROWTYPE because AFIK you need it when declaring > in plpgsql's DECLARE No, you don't, as 36.4.3 says perfectly clearly. %ROWTYPE is an Oracle-ism that we support inside plpgsql, but not elsewhere.

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Tino Wildenhain
Am Sonntag, den 04.12.2005, 09:56 -0600 schrieb Bruno Wolff III: > On Sun, Dec 04, 2005 at 14:40:49 +0100, > Tino Wildenhain <[EMAIL PROTECTED]> wrote: > > > > Doing something to enable aggregates in general to use > > an existent index would be a nice ide imho. > > (With all the visibility hint

[GENERAL] postgresql jdbc connect via hostname instead of just ip

2005-12-04 Thread Jonathan Schreiter
Hi all, I'm a bit new to postgresql. I've been able to configure the database and the jdbc interface successfully. I interface via PAM (krb5) and that works OK in the pg_hba.conf file. I've added the -i option to the postmaster startup script service (using binary RPMs on Fedora Core 4) for tcp c

Re: [GENERAL] postgresql jdbc connect via hostname instead of just ip

2005-12-04 Thread Douglas McNaught
Jonathan Schreiter <[EMAIL PROTECTED]> writes: > The only way I can connect to the database via JDBC > seems to be by IP address (both locally and on another > system allowed by the pg_hba.conf file). > > jdbc:postgresql://theipaddressofdatabaseserver/mydatabase > > I'd like to be able to connect

[GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread vishal saberwal
hi, We are storing the Icons/IMages in the database as Large Objects using lo_import functions. (1) what would be the return type if i want to return a large object (XYZ.gif) to the remote client (GUI) using stored procedure. Can anyone give an example please? Are there any size limitations i ne

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Greg Stark
Tino Wildenhain <[EMAIL PROTECTED]> writes: > Am Sonntag, den 04.12.2005, 09:56 -0600 schrieb Bruno Wolff III: > > On Sun, Dec 04, 2005 at 14:40:49 +0100, > > > > Assuming you are refering to max and min, this has already been done and is > > in 8.1. > > I also mean sum, avg, ... and last not le

[GENERAL] Creating then dropping primary key constraint

2005-12-04 Thread Havasvölgyi Ottó
Hi, I noticed that when I create a primary key with ALTER TABLE ... ADD CONSTRAINT ... PRIMARY KEY (...), and then drop this constraint, then the "not null" modifier stays on the column on which the primary key was defined although there were no constraint on that column before. Is this norma

Re: [GENERAL] 8.1, OID`s and plpgsql

2005-12-04 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Related to the original question though, is there actually any way to > get the ctid of a row that was just inserted? No. You'd have to identify the rows some other way (a sequence is the canonical way), and then grab the ctid from that. - -- Gre

Re: [GENERAL] postgresql jdbc connect via hostname instead of just ip

2005-12-04 Thread Jonathan Schreiter
Thanks for the help - it was a dns resolving issue after all as you described. Jonathan --- Douglas McNaught <[EMAIL PROTECTED]> wrote: > Jonathan Schreiter <[EMAIL PROTECTED]> > writes: > > > The only way I can connect to the database via > JDBC > > seems to be by IP address (both locally an

Re: [GENERAL] int to inet conversion

2005-12-04 Thread Anton Nikiforov
Martijn van Oosterhout wrote: On Sun, Dec 04, 2005 at 03:21:47PM +0300, Anton Nikiforov wrote: Martijn van Oosterhout wrote: Let i be your input. Calculate t = -i. If i is in the right format, t will have exactly one bit set. Test this with t <> 0 and (t & i) == t If that's ok, then your ans

[GENERAL] Some rare questions

2005-12-04 Thread Havasvölgyi Ottó
Hi, I am writing a driver for PostgreSQL, and I need some rare info: How can I query the collation/locale of the database cluster? What can be the maximal length of the indexed part of the string. So I have a text field, and I create an index on it. How long can be one index key max in this

Re: [GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread Jan Wieck
On 12/4/2005 7:55 PM, vishal saberwal wrote: hi, We are storing the Icons/IMages in the database as Large Objects using lo_import functions. (1) what would be the return type if i want to return a large object ( XYZ.gif) to the remote client (GUI) using stored procedure. Can anyone give an exa

Re: [GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread Joshua D. Drake
(1) what would be the return type if i want to return a large object ( XYZ.gif) to the remote client (GUI) using stored procedure. Can anyone give an example please? Are there any size limitations i need to consider when returning Large Object using procedures? You have to use a lookup table th

Re: [GENERAL] Some rare questions

2005-12-04 Thread Bruce Momjian
The answers to these are either "unlimited" or mentioned in the FAQ. --- Havasv?lgyi Ott? wrote: > Hi, > > I am writing a driver for PostgreSQL, and I need some rare info: > > > How can I query the collation/locale of the

Re: [GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread Jan Wieck
On 12/4/2005 9:24 PM, Joshua D. Drake wrote: (1) what would be the return type if i want to return a large object ( XYZ.gif) to the remote client (GUI) using stored procedure. Can anyone give an example please? Are there any size limitations i need to consider when returning Large Object using

Re: [GENERAL] Slow COUNT

2005-12-04 Thread Bruno Wolff III
On Sun, Dec 04, 2005 at 18:28:53 +0100, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > Am Sonntag, den 04.12.2005, 09:56 -0600 schrieb Bruno Wolff III: > > On Sun, Dec 04, 2005 at 14:40:49 +0100, > > Tino Wildenhain <[EMAIL PROTECTED]> wrote: > > > > > > Doing something to enable aggregates in g

Re: [GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread Joshua D. Drake
This doesn't answer the question. Fact is that most procedural languages (including PL/pgSQL) don't have any access to classic large objects in the first place. So all the stored procedure can do is to return the identifier of the large object to the client and the client must then use lo_ope

Re: [GENERAL] Selecting Large Object and TOAST

2005-12-04 Thread Jan Wieck
On 12/4/2005 11:45 PM, Joshua D. Drake wrote: Well as I said it depends on the size of the data. Are we talking 100 meg vector images? Then large objects. Are we talking thumbnails that are 32k then bytea. I'd say that anything up to a megabyte or so can easily live in bytea. Beyond that it

[GENERAL] Inheritance Algebra

2005-12-04 Thread Trent Shipley
[ This post is theory oriented, so it can't go in HACKERS nor can it go in SQL so it gets posted to GENERAL. I would polish this more. Unfortunately, it is at the point were I'd seek feedback were I in a seminar. ] Relational Constraint Inheritance Algebra With regard to class and attribute u