Re: [GENERAL] Looping through arrays

2005-11-04 Thread Joe Conway
Robert Fitzpatrick wrote: I have a field with 'AA-BB-CC-DD' and I want to pull those four values into an array and then loop through the array inserting records into a table for each element. Can you someone point me to an example of this in pl/pgsql? Something like this? create table

Re: [GENERAL] Image File System Question

2005-11-04 Thread Richard Huxton
vishal saberwal wrote: hi, My server is Postgres 8.0.1 on fedora core2. My clients are remote and interface with my server using .NET GUI. We are trying to store many images/icons/audio/video clips in our system. We expect many of these. The way we are doing it is using Hierarchical File

Re: [GENERAL] SQL injection

2005-11-04 Thread Benjamin Smith
Prepared statements are the way to go. I developed my own prepared statements methodology (I called it SafeQuery) some time back before discovering that others had done it. It's so nice, since I've not worried about SQL injection for YEARS. Sample of my API: ? $sql=SELECT auth.login FROM

[GENERAL] records to text representation

2005-11-04 Thread Peter Filipov
Is there any way to covert an instance of a composite type to text, to store it in a text column, and then to recreate the original object? For example: create type test as (a integer, b text); create tble tstore (s text); insert into tstore values((someproc((row(1, 'tst'))::test))::text);

[GENERAL] Using native win32 psql.exe using alternative cygwin terminal

2005-11-04 Thread Richard van den Berg
I just installed postgresql 8.1-rc1 on a Windows 2003 machine. Since I like psql a lot, and hate the cmd.exe terminal, I use puttycyg instead. When I tried using psql.exe in a puttycyg terminal, after entering my password for the database, the screen just hangs. When I do the same from a cygwin

Re: [GENERAL] how to emit line number in a function?

2005-11-04 Thread Jerry Sievers
Bricklen Anderson [EMAIL PROTECTED] writes: I couldn't find any useful references in the docs or archives for emitting the line number of a plpgsql function (in a RAISE statement). I'd like to use it for debugging some complex functions. Does anyone have any tips on where to look, or an

Re: [GENERAL] Image File System Question

2005-11-04 Thread vishal saberwal
thanks for your response, We are kind of jailing (may be hiding would be a better term) resources behind the database/Stored procedures and GUI needs to have a feel as if the data is comming from database. Its a requirement for the project that any communication of resources and data be done

Re: [GENERAL] Image File System Question

2005-11-04 Thread Douglas McNaught
vishal saberwal [EMAIL PROTECTED] writes: Did try finding something about HFS for ext3/xfs but in vain. The information i found was the conversion between these file systems. What exactly do you mean by HFS? All modern filesystems are hierarchical. -Doug ---(end of

Re: [GENERAL] Image File System Question

2005-11-04 Thread vishal saberwal
HFS is the filesystem richard was tlking about. I am not familiar with this file system but i guessed it was HFS+ that he was talking about. yes, i understand all modern filesystems are Hirearchical file systems. thanks, vishOn 11/4/05, Douglas McNaught [EMAIL PROTECTED] wrote: vishal saberwal

Re: [GENERAL] how to emit line number in a function?

2005-11-04 Thread Bricklen Anderson
Jerry Sievers wrote: Bricklen Anderson [EMAIL PROTECTED] writes: I couldn't find any useful references in the docs or archives for emitting the line number of a plpgsql function (in a RAISE statement). I'd like to use it for debugging some complex functions. Does anyone have any tips on

Re: [GENERAL] Image File System Question

2005-11-04 Thread Richard Huxton
vishal saberwal wrote: HFS is the filesystem richard was tlking about. I am not familiar with this file system but i guessed it was HFS+ that he was talking about. yes, i understand all modern filesystems are Hirearchical file systems. Ah, you said (H)ierarchical (F)ile (S)ystem in the

Re: [GENERAL] Image File System Question

2005-11-04 Thread Douglas McNaught
vishal saberwal [EMAIL PROTECTED] writes: HFS is the filesystem richard was tlking about. I am not familiar with this file system but i guessed it was HFS+ that he was talking about. yes, i understand all modern filesystems are Hirearchical file systems. Oh, OK--reading your original message,

[GENERAL] tablename.columnname notation for columnnames of joined tables

2005-11-04 Thread dgroth
Hello, I know it is possible in other dbs like sqlite. Let's say I have two tables which I want to join owners (name,age) and dogs (name,owner,age). select * from owners as a join dogs as b on a.name = b.owner How could I convince postgres to prefix the returned columnnames with the tablename

[GENERAL] BLOB and OID

2005-11-04 Thread Lolke B. Dijkstra
Hi, OID being a 4 byte int seems limited to indexing for binary objects. More precisely I use BLOB to store images in the database and link these objects to another table using the OID as FK. If I run out of OID there will be no way to index new images. Of course when not automatically

Re: [GENERAL] Oracle 10g Express - any danger for Postgres?

2005-11-04 Thread Bob
On 11/1/05, Tom Lane [EMAIL PROTECTED] wrote: Jan Wieck [EMAIL PROTECTED] writes: On 10/31/2005 1:14 PM, Chris Browne wrote: The fact that it appears a joke to people wanting to deploy big databases doesn't prevent it from taking a painful bite out of, oh, say, certain vendors that forgot

[GENERAL] Bug in Role support?

2005-11-04 Thread Florian G. Pflug
Hi I wanted to try out the new role support in 8.1. My goal is to create two roles, dev and admin, and make all other users member of those two roles. The users shall then issue either set role dev (if the want to to development work), or set role admin (in the rare case where they need

Re: [GENERAL] Bug in Role support?

2005-11-04 Thread Tom Lane
Florian G. Pflug [EMAIL PROTECTED] writes: grant admin to fgp ; The last statement fails with role admin is a member of role fgp - but I believe it is not. Did I do something wrong, or is this really a bug? Looks like a bug to me too. I think it's coming from the fact that

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Alex Turner
I think he meant create sequence test_seq; select setval('test_seq',(select max(primary_key_id) from my_table)); not max value of a serial type. Alex On 11/3/05, Marc Boucher [EMAIL PROTECTED] wrote: On Wed, 02 Nov 2005 19:29:10 -0800, you wrote: It's a migration thing - MySQL prevented

[GENERAL] Division

2005-11-04 Thread Robert Fitzpatrick
I am having a problem gettig a percent via division. Below is the first part of my trigger function where pct returns 0.00, instead of the expected 0.50. If I try without dimensions to the numeric variable, I just get 0. What is the correct way to accomplish the percent? CREATE OR REPLACE

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Jerry Sievers
Steven Brown [EMAIL PROTECTED] writes: I'm granting access to insert/update/delete rows of a table to people, but I don't want all future inserts to fail if they decided to change an id (which they obviously shouldn't, but they /can/). It makes for a fragile system. create rule

Re: [GENERAL] Division

2005-11-04 Thread Peter Eisentraut
Robert Fitzpatrick wrote: I am having a problem gettig a percent via division. Below is the first part of my trigger function where pct returns 0.00, instead of the expected 0.50. If I try without dimensions to the numeric variable, I just get 0. What is the correct way to accomplish the

Re: [GENERAL] Image File System Question

2005-11-04 Thread Csaba Nagy
See my comments below. On Fri, 2005-11-04 at 15:24, vishal saberwal wrote: thanks for your response, We are kind of jailing (may be hiding would be a better term) resources behind the database/Stored procedures and GUI needs to have a feel as if the data is comming from database. Its a

[GENERAL] pl/pgsql list as parameter.

2005-11-04 Thread Assad Jarrahian
Hi, I have a couple questions, I am tryingto write a function that takes as input a list (size being dynamic) of primaryIDKeys, along with a userdefined type and returns a set of rows containing those keys. Furthermore the rows are exactly (columns) like the table that contains the keys, but has

Re: [GENERAL] Image File System Question

2005-11-04 Thread vishal saberwal
thanks for all your prompt reponses but i am still not clear with the way to solve the problem.I am sorry if i wasn't clear with my problem the first time. My problem isn't file system and the way i lay it out. What i need to know is a way to stream out external resource files via stored

Re: [GENERAL] Division

2005-11-04 Thread Robert Ftizpatrick
On Fri, 2005-11-04 at 18:39 +0100, Tino Wildenhain wrote: CREATE OR REPLACE FUNCTION public.issue (varchar) RETURNS numeric AS' DECLARE repar text[]; pct numeric(3,2); noreps integer; BEGIN repar := string_to_array($1,''-''); noreps := array_upper(repar,1); pct

Re: [GENERAL] BLOB and OID

2005-11-04 Thread vishal saberwal
yes, there is one, but i dont know how would you modify the PostgreSQL code. You can implement a GUID datatype and can use it as indexing which guarantees uniqueness and can be stored in double format. thanks, vishOn 11/4/05, Lolke B. Dijkstra [EMAIL PROTECTED] wrote: Hi,OID being a 4 byte int

[GENERAL] Missing seconds in a date (timestamp)

2005-11-04 Thread EliƩzer Madeira de Campos
Hello everyone: I'm working to upgrade a database from PostgreSQL 7.3 to 8.0 version.The database serves a complex J2EE application, running Jboss in multiple servers. All servers run Linux RedHat.I found a problem yesterday.Whenever the application inserts a date prior to 1914-01-01, the

Re: [GENERAL] Division

2005-11-04 Thread Tino Wildenhain
Am Freitag, den 04.11.2005, 12:13 -0500 schrieb Robert Fitzpatrick: I am having a problem gettig a percent via division. Below is the first part of my trigger function where pct returns 0.00, instead of the expected 0.50. If I try without dimensions to the numeric variable, I just get 0. What

[GENERAL] I just can't get it:record_in, record_out(I know i try to do something postgres is not developed for but there are many 'buts')

2005-11-04 Thread Peter Filipov
This is what i can't get right: CREATE type tst_tst as (a integer, b text); CREATE OR REPLACE FUNCTION tst_store(a anyelement) RETURNS text AS $$ BEGIN RETURN textin(record_out(a)); END $$ LANGUAGE PLPGSQL; create or replace function tst_load1(a text) returns tst_tst as $$ declare

Re: [GENERAL] Image File System Question

2005-11-04 Thread Jan Peterson
We have a similar functional requirement to Vishal's, but with an added twist. Currently, we are utilizing the pg_largeobject table to store context data delivered through our java application. We are finding, however, that very large pg_largeobject tables degrade our performance in other areas

Re: [GENERAL] Replicating databases

2005-11-04 Thread Jim C. Nasby
On Thu, Nov 03, 2005 at 10:29:56PM -0500, Christopher Browne wrote: On Wed, Nov 02, 2005 at 03:44:26PM -0800, Marc Munro wrote: experts there may suggest a better solution. I have seen talk of disabling the standard slony triggers to allow this sort of thing but whether that is more or

Re: [GENERAL] Save prepared plan...

2005-11-04 Thread Jim C. Nasby
On Thu, Nov 03, 2005 at 03:22:34PM -0600, Cristian Prieto wrote: Save globally for all session or between sessions. Well, I have a set of queries which runs several times. My clients connect and execute it. But each time the client connects and disconnects, that means that I loose the

Re: [GENERAL] pl/pgsql list as parameter.

2005-11-04 Thread Tom Lane
Assad Jarrahian [EMAIL PROTECTED] writes: How do you take in a list of int? Use an array. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an

Re: [GENERAL] pl/pgsql list as parameter.

2005-11-04 Thread David Gagnon
Hi, Here is an example Regards /David CREATE OR REPLACE FUNCTION usp_Inventaire_Transaction_Statut_Changer(int[], varchar, int, date) RETURNS INTEGER AS ' DECLARE requestIds ALIAS FOR $1; companyId ALIAS FOR $2; targetStatus ALIAS FOR $3; transactionDate ALIAS FOR $4; transactionDate_

Re: [GENERAL] Replicating databases

2005-11-04 Thread Christopher Browne
But if someone decided to fork their own *new* project, perhaps starting based on one of the releases, that would an entirely interesting idea. Wouldn't async multimaster make use of most all of what slony-I currently has? ISTM that it would make life a lot easier to use one combined

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Marc Boucher
At 11:49 04/11/2005 -0500, Alex Turner wrote: I think he meant create sequence test_seq; select setval('test_seq',(select max(primary_key_id) from my_table)); not max value of a serial type. What I understand, and from what I know by using mysql, is that mysql auto-adjust the max value of a

[GENERAL] Duplicate Row Removal

2005-11-04 Thread Peter Atkins
All, I have a duplicate row problem and to make matters worse some tables don't have a PK or any unique identifier. See below: uid | cleanval | timestamp | received -+---++-- 38 | 5 | 1125081799 |1 38 |14 | 1122683252 |0 38 | 5 |

Re: [GENERAL] Duplicate Row Removal

2005-11-04 Thread Tom Lane
Peter Atkins [EMAIL PROTECTED] writes: I was hoping to have a system oid for each row but it looks like that's not the case. Anyone have any thoughts on how to remove dups? ctid always works ... regards, tom lane ---(end of

Re: [GENERAL] Duplicate Row Removal

2005-11-04 Thread Dean Gibson (DB Administrator)
CREATE TABLE new_name AS SELECT DISTINCT * FROM old_name; DROP TABLE old_name; ALTER TABLE new_name RENAME TO old_name; On 2005-11-04 17:15, Peter Atkins wrote: All, I have a duplicate row problem and to make matters worse some tables don't have a PK or any unique identifier. Anyone have