[SQL] Correct syntex for implicit curor in for loops

2001-06-21 Thread Najm Hashmi
Hi All, Could someone  please tell me the Correct syntex for implicit curor in FOR loops Thank  you in advance. --  Najm Hashmi Tel:514-271-9791 www.mondo-live.com www.flipr.com  

[SQL] Extracting date from epoche

2001-06-20 Thread Najm Hashmi
Hi I have some data  that is  supose to be  a date but in ecpoche format. How can I reonvert  it to data format. Thanks in advance for help. Regards, --  Najm Hashmi Tel:514-271-9791 www.mondo-live.com www.flipr.com  

[SQL] Bit Mapping operation

2001-06-12 Thread Najm Hashmi
this info somewhere in the docs? Thanks in advance. Regards, --  Najm Hashmi Tel:514-271-9791 www.mondo-live.com www.flipr.com  

[SQL] ERROR: parser: parse error at or near "$1"

2001-05-28 Thread Najm Hashmi
into artist_details( artist_id,crh_id,labels_id, coll_ids,name,info) values (art.artist_id,art.crh_id,lab_ids,coll_ids,art.name,art.extrinfo); end loop; return ''t''; end; ' language 'plpgsql'; select populate_art_details(); Regards, -- Najm Hashmi Tel:514-271-9791 ww

Re: [SQL] Calculating the age of a person

2001-05-22 Thread Najm Hashmi
or up without writing a function. Is there any possibility > to use plain SQL only? > > Hans > > > ---(end of broadcast)--- > TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] Hey Hans try usting date_part function..

[SQL] To Run 2 database servers at the same time

2001-05-16 Thread Najm Hashmi
correctly? Any doc links would also greatly appreciateld. Thank you all for your help. Regards   --  Najm Hashmi Tel:514-271-9791 www.mondo-live.com www.flipr.com  

Re: [SQL] Re: \i command

2001-04-10 Thread Najm Hashmi
Joel Burton wrote: > On Wed, 11 Apr 2001, Najm Hashmi wrote: > > > Hi All, > > From pgsql, I try to insert data in table using the \i command. Nothing > > takes place and after this command pgsql is hung... i cant use it any more. > > The same command works wit

[SQL] \i command

2001-04-10 Thread Najm Hashmi
Hi All, From pgsql, I try to insert data in table using the \i command. Nothing takes place and after this command pgsql is hung... i cant use it any more. The same command works with all other tables but this is only one I am having problem with. I have attached my file with message. Could so

[SQL] Error:TypeCreate: type links already defined

2001-04-02 Thread Najm Hashmi
Hi all, I have posted my question since last Thurday and noone has answered it yet. My problems is that I droped a table using pgaccess from pg_class. Now If I try to create that table I get the following error: TypeCreate: type links already defined. Could some one help me out here. Regards

[SQL] TypeCreate: type links already defined

2001-03-30 Thread Najm Hashmi
HI all, I just posted a message about droping a table. I droped it using pgaccess from the pg_class table. Now  I want to recreate the table and I get the following message: TypeCreate: type links already defined I need to fix this problem in hurry please someone could reply to it. Thanks alo

[SQL] Error on Drop table

2001-03-30 Thread Najm Hashmi
Hi, I am trying to drop a table and I get the following error: drop TABLE  links; ERROR:  RelationBuildTriggers: 1 record(s) not found for rel links mondo=# Could someone explain  this to me. I would really appreciate the help.   begin:vcard n:Hashmi;Najm x-mozilla-html:FALSE org:Mondo-Live.com

[SQL] pg_dump error plus RelationBuildTriggers: 1 record(s) not found for rel links

2001-03-29 Thread Najm Hashmi
Hi all, here is error I that am getting: pg_dump -s mondo > mondo.out PQgetvalue: ERROR! tuple number 0 is out of range 0..-1 I faced similar example in the past too. At that time, there was a referentional constraint problem but this situation is different. I am usning postgres 7.0.3 on redh

[SQL] is it me or trigger side effects

2001-03-26 Thread Najm Hashmi
Hi all, I have written a trigger to update a table called categories whenever a tuple is either deleted or inserted in tables articles, media, and links. It works fine for inserts but "pukes" on deletes :). I am using two auxiliary addcount(varchar) and delecount (varchar) I am getting the follow

[SQL] Postgres & XML

2001-03-19 Thread Najm Hashmi
Hi all, I was just wondering if there is way or some sort of utility to incorporate XML in postgrres. Thanks in advance. begin:vcard n:Hashmi;Najm x-mozilla-html:FALSE org:Mondo-Live.com;www.flipr.com adr:;; version:2.1 email;internet:[EMAIL PROTECTED] x-mozilla-cpt:;6144 fn:Najm Hashmi en

[SQL] Max Conncection limit?

2001-03-12 Thread Najm Hashmi
We start a server and initiate 30 connections(with the libpq C interface) which are stored in a stack to use and and to be reused. After awhile I try to start another server that will also try to initiate 30 connections, for each connection I then get a PQErrorMessage like that : "Sorry, too

[SQL] from PosgreSQL 7.1b3 to 7.0.3

2001-03-09 Thread Najm Hashmi
I have PosgreSQL 7.1b3 running on one of our test servers. It seems like PosgreSQL 7.1b3 is not very stable. I want to go back to 7.0.3v since it it the most stable version available. I am just wondering what should I do. can I reinstall 7.0.3 on 7.1b3 directly ? If not then what steps should

Re: [SQL] quotes in pl/pgsql 0n variable type text or varchar

2001-03-08 Thread Najm Hashmi
Roberto Mello wrote: > On Thu, Mar 08, 2001 at 05:54:38PM -0500, Najm Hashmi wrote: > > Hi all, I just want to know how to put quotes around a string. Is there a > > function to do so? > > If not how can I escape a single quote. > > Others have answered how

[SQL] quotes in pl/pgsql

2001-03-07 Thread Najm Hashmi
Hi all, I just want to know how to put quotes around a string. Is there a function to do so? If not how can I escape a single quote. Thank you in advance. begin:vcard n:Hashmi;Najm x-mozilla-html:FALSE org:Mondo-Live.com;www.flipr.com adr:;; version:2.1 email;internet:[EMAIL PROTECTED] x-m

[SQL] Controlling Reuslts with Limit

2001-02-23 Thread Najm Hashmi
Hi, I was reading through Bruce's on line . I found follwing bit unclear... "Notice that each query uses ORDER BY . Although this clause is not required, LIMIT without ORDER BY returns random rows from the query, which would be useless. " When I run a query several time I get the same results

[SQL] Wierd postgres Problem

2001-02-12 Thread Najm Hashmi
Hi All, I am trying to define a new set of tables an I am getting this strange syntex problem on date, or timestamp data types. I am also getting error on not null constranit as well... Postgres is behaving strangely first definations with not null cmdb=# create table media_received ( cmd

[SQL] String Concatnation

2001-02-09 Thread Najm Hashmi
Hi, How can I concatnate two varialbles, seperated by a |, that are type text together? v, v1 text; some work then res:= v ||''|''|| v1; this syntex does not work in plpgsql?? Any ideas how to do it ??? Thanks. Najm

Re: [SQL] What's wrong with this function

2001-02-09 Thread Najm Hashmi
Jie Liang wrote: > I just know you can use implict cursor inside the plpgsql > e.g > declare result text; tcount int4; > > rec record; > begin > FOR rec IN select_clause LOOP > statements > END LOOP; > end; > Thank you Jie for your help. I am bit confused about how it works. I want for ea

[SQL] What's wrong with this function

2001-02-09 Thread Najm Hashmi
Hi all, Here is a plpgsql function: flipr'#create function test_cur() returns text as' flipr'# declare flipr'# mycur cursor for select title from songs where song_id=10; flipr'# usrrecord; flipr'# resultstext; flipr'# begin flipr'# open mycur; flipr'# fetch next from mycur into

[SQL] pgsql and cursor

2001-02-09 Thread Najm Hashmi
Hi all, I am not sure If it is allowed to use cursor inside pgsql functions. If it is possible, please someone could send exact synatx how it is used. If it is not allowed is there a way arround it? I need to do some calculations and then return this value as text. Thanks in advance for all your

[SQL] Index scan

2001-01-31 Thread Najm Hashmi
Hi all, I am unable to understand why my inidcies are not used in the query. I have following indices: index on categories.root index on media.category unique index on categories.id Here is my query : mondo=# explain select m.id form media m, categories c

Re: [SQL] Permissions for foreign keys

2001-01-31 Thread Najm Hashmi
Hey Rick, I am sure there are more elegant solutions but I have a simple one. Write a trigger that will grant the permissions before insert or update and and revoke all privileges after the insert or update. -Najm Rick Delaney wrote: > I'm using 7.0 and have noticed that I need to gr

Re: [SQL] How to change the ownership of the table?

2001-01-24 Thread Najm Hashmi
> > > Working out the exact UPDATE command to use is left as an exercise > for the student ;-) > > regards, tom lane It is funny.. LOL Najm

Re: [SQL] Correct Syntax for alter table ..add constraint

2001-01-19 Thread Najm Hashmi
Josh Berkus wrote: > Najm, > > > references age_list(id); > > And I get the following error: > > flipr=# alter table users > > flipr-# add constraint age_fk foreign key(age) references > > age_list(id); > > NOTICE: ALTER TABLE ... ADD CONSTRAINT will create > > implicit trigger(s) > > for FOREIG

[SQL] Correct Syntax for alter table ..add constraint

2001-01-19 Thread Najm Hashmi
Hi All, What is the correct syntax for adding a foreign key constraint from the command line. I am using v7.1 beta3. I am doing the follwoing: alter table users add constraint age_fk foreign key(age) references age_list(id); And I get th

Re: [SQL] Selecting Current value from a sequence

2001-01-18 Thread Najm Hashmi
Thank you all for your help. Najm

[SQL] Selecting Current value from a sequence

2001-01-18 Thread Najm Hashmi
Hi all, It is a very simple but I am not able to recall how to do it I just need to find out the current value of a seq. It is very simple select statement but I can't recall it... Help me please before I get myself get fired -:). Regards, Najm

[SQL] pl/pgsql Limits

2001-01-12 Thread Najm Hashmi
Hi All, As it is known that any funtion, written in pl/pgsql, can only retrun one tuple. I am just wondering it were true as well for function written in C language. I need to write few function that will retrun mulitiple rows satsifying a certain set of conditions. Where I can get some ex

[SQL] SQL funtion

2001-01-12 Thread Najm Hashmi
Hi All, I have written a very simply function as follows: create function song_info(int4) returns setof songs as' select songs.* from songs where $1=song_id' language 'sql'; when iIcall it I get the following:flipr=# select song_info(4); ?column?

[SQL] PostGreSql7.1 beta version

2001-01-12 Thread Najm Hashmi
Hi all, I am just wondering where can i find the link to down load PostGreSql7.1 beta versoin . I heard it is very stable my be I can use it see how many times I tumble on bugs I don't do it intentionally but it happens to me all the time :)... Regards. Najm

[SQL] pqReadData()

2001-01-05 Thread Najm Hashmi
Hi all, I was trying to simply update single field in one of my tables as given below: fliprdb=# update artist set extrinfo='independent' where artist_id=6; pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally before or wh

[SQL] About Index

2001-01-02 Thread Najm Hashmi
Hi, I have created a table songs as follwoing: CREATE TABLE songs ( song_id serial NOT NULL, title character varying(50) NOT NULL, composer varchar(50), performer varchar(50), artist_id int4 not null, file_size int4, description text, extrInfo t

[SQL] pg_dump Error

2000-12-21 Thread Najm Hashmi
Hi all, while trying to dump db shcema and content, I am getting the following error: [najm@localhost najm]$ pg_dump -D fliprdb > flipr.sql PQgetvalue: ERROR! tuple number 0 is out of range 0..-1 Segmentation fault (core dumped) Any suggestion what I am doing wrong and why i am

[SQL] Cache lookup failure

2000-11-29 Thread Najm Hashmi
Hi All, I am trying to do a simple insert, and I am getting cache look failure error. Could someone explain what causing it? My query and error are given below: fliprdb=# insert into collection(name, artist_id) values('El Baile Aleman',2); ERROR: fmgr_info: function 24011: cache lookup failed Tha

[SQL] Cache look up failure

2000-11-29 Thread Najm Hashmi
Hi All, I am trying to insert a tuple in the tuple, and i am getting the follwoing error message: fliprdb=# insert into collection(name, artist_id) values('El Baile Aleman',2); ERROR: fmgr_info: function 24011: cache lookup failed Can someone help me out here. Thnaks in advance for your help.

[SQL] [sql]Joins

2000-11-09 Thread Najm Hashmi
I am facing a dilemma at my work, I am using postgres first time. For some reason, my co-workers think that in Postgres joins i.e. simple joins of two or three tables are so bad that their cost is exponential. They believe that postgres simply takes Cartesian product of joining table in order t

Re: [SQL] Re: Returning Recordsets from Stored-procs

2000-11-06 Thread Najm Hashmi
Andreas Tille wrote: > On Mon, 6 Nov 2000, Grant Finnemore wrote: > > > Whilst this is an unfortunate position at the moment, it has been my experience >that it does not cause insurmountable problems. > > (Some short term headaches - yes. ;-) > After learning this as a fact you have short term h

Re: [SQL] INSERT [IGNORE] INTO TABLE

2000-10-31 Thread Najm Hashmi
Edmar Wiggers wrote: > > If I try to insert some row which in the table already exist the > > postgre don't insert it and tell some error. Everything ok. > > I'll insert only if there is not the same (same key) record, > > else don't insert and don't tell me errors about i

[SQL] Need help! parse erro

2000-10-30 Thread Najm Hashmi
Hi every one, I have just strated to use postgres. I wrote a vert simple pl/pgsql function as given below: CREATE FUNCTION add_new_user(varchar(32),char(8),varchar(128),varchar(128),varchar(32), varchar(32)) RETURNS boolean AS' DECLARE oldUser RECORD; USR ALIAS FOR $1; PWORD ALIAS FOR $2; EMAIL A

[SQL] Need info: pl/pgsql performance

2000-10-23 Thread najm Hashmi
Hi, I would to know if there is any articles or books that talk about pl/pgsql performance especially versus C. Thanking you in advance for your help. Regards. Najm