[SQL] hiding pg messages in c programs

2001-06-12 Thread Markus Wagner
Hi, how can I disable the output of pg sql commands on the shell from within my C programs? Thanks, Markus ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED]

[SQL] PL/pgsql question

2001-06-12 Thread Andrea Suisani
hi, i define a function using pgacces with pl/pgsql. it seems that the queries define in the function wasn't executed. if I try to excute the same queries from the psql everything, really, works fine. the body of the function is: --- Declare rec_struttura record;

[SQL] Re: php-nuke

2001-06-12 Thread Nils Zonneveld
Sharmad Naik wrote: > > hi, > I wanted to know that does postgresql database support php-nuke > It's more the other way around, does php-nuke support PostgreSQL. The answer: AFAIK they still have to build a dbms bridge for PostgreSQL. In Phorum for instance you have different bridges f

[SQL] Re: Distinct Values

2001-06-12 Thread Hans-Jürgen Schönig
I want a "dirty" solution try something like that. If you use "group by author" url must be in aggregate function. The authors are now DISTINCT. myjava=# SELECT author, max(url) FROM books group by author; author | max +- abc| dsafsdf cde| sdfdsf (2 rows) Hans

[SQL] Foreign key to base table with rows in inherited tables

2001-06-12 Thread Mikael Kjellström
I've declared a foreign key in table FileId referencing the primary key in Datafile. Datafile in itself does'nt have any rows, but Reservationfile, inheriting from Datafile has. I can't insert a row in FileId because no row is found in Datafile: this is not what I expected. I've tried suffixi

[SQL] PL/PGSQL

2001-06-12 Thread Andrzej Roszkowski
Hi! I can't find any info about possible data types that can be returned from procedure. I want to return tuple. When I use OPAQUE as a return type I get error message that OPAQUE can be only returned from trigger. It is possible to do this without triggers? --

[SQL] Cluster and primary key

2001-06-12 Thread Mikael Kjellström
I can't find a way to cluster a table on another index and keep it's primary key. When I define the table the primary key is created, but it's dropped when I cluster the table on another index. I've tried "alter table add constraint", but that's not supported for primary keys. I'm running 7.

[SQL] cascading delete - recursivity

2001-06-12 Thread Postgresql
Hi, I have a table of categories (it's pseudo-sql...) : CATEGORIES ( id_category PRIMARY KEY, id_category_parent (FOREIGN KEY ? CONSTRAINT ??) , cat_text ) There is recursivity : id_category_parent is -1 (= no parent cat) or the id_category of a category in this table. What is the S

[SQL] Re: Distinct Values

2001-06-12 Thread Hans-Jürgen Schönig
Nicolas schrieb: > Hi, > > I'm trying to retreive DISTINCT Values from a two colomn table called > "Books". The colomns are named "Author" and "URL". > DISTINCT values should be retieved from the "Author" Colomn , and then I > should be able to retrieve the corresponding URL. > How do I build the

[SQL] audit trail and system catalogs

2001-06-12 Thread Markus Wagner
Hi, we strongly need to implement an audit trail as a prerequisite for clinical trials, that is a functionality which records any change of any data item in a database into one single table containing these events. I found that one could use rules for this, but this would require one rule for

[SQL] Re: rpt

2001-06-12 Thread Jeff Boes
In article <[EMAIL PROTECTED]>, "Hilkiah Lavinier" <[EMAIL PROTECTED]> wrote: > Hi, this is probably not the correct group for this post, but it's kinda > related. Does anyone know of a report writer/generator that works for > postgres? It would be nice if it is natively built in or some 3rd pa

[SQL] multiple sql update w/ major time issues

2001-06-12 Thread Dawn
I have a sql update statement that is dealing with hundreds of thousands of records. It takes hours and hours to complete (if it does complete and not take down the server). Here is how I have it right now: update aud_member_ext_attributes b set EXTVALUE217 = (select a.MTD from

[SQL] Please help! Functions passing records between them

2001-06-12 Thread Alla
Guys; I am begging for your help again. I can't find a solution to my problem. I am porting a complex system from Oracle to PostgreSQL and I need to implement the following: function 1 does some processing and returns a record (I can declare it as a row in a view) function 2 uses func1 to get

[SQL] Sub-SELECT uses un-GROUPed attribute: how to solve.

2001-06-12 Thread Gaizka Villate
Hi all! I want to make a report of (let's say) object sales, and i'm getting the error: Sub-SELECT uses un-GROUPed. I think this will be better understand with an example: (this is a over-simplified one, but it gets the point). (See data model and data to fill it below.) If i have: SALES: -

[SQL] which sql syntax is better for joins on pgsql?

2001-06-12 Thread fabrizio
Hi all...one question..which sql syntax for joins will perform better on pgsql.. something like xxx OUTER JOIN yyy or SELECT xxx,yyy FROM bbb,ccc WHERE bbb.xxx = ccc.yyy ?? Are there any performance differences in executing these to queries in pg or will they be the same in means of time and resou

[SQL] Re: update from another table

2001-06-12 Thread JWR
That doesn't tend to work in any SQL database I've ever used, though I'm told Informix can do something similiar. You need to insert the data into a temp table then delete the rows in the base table, then insert back from the temp table. Yeah it is a pain. John "ivan" <[EMAIL PROTECTED]> wrot

[SQL] Getting row with id=max(id)

2001-06-12 Thread Gerald Gutierrez
I'd like to retrieve a row of a table that has the maximum ID. For example, with: id | s +--- 1 | alpha 2 | beta 3 | gamma 4 | delta I'd like to get the row with ID=4. I've tried: SELECT * FROM mytable WHERE id=(SELECT MAX(id) FROM mytable); The subquery can take a /r

[SQL] Integrity reference and inheritance

2001-06-12 Thread Christophe Labouisse
I wanted to build the following schema : - one "generic" document table with a column doc_id ; - a couple of "specific" document tables inheriting from doc ; - a table refering a document by it's id with and integrity constraint on it. In SQL : CREATE TABLE doc ( doc_id serial PRIMARY K

[SQL] rpt

2001-06-12 Thread Hilkiah Lavinier
Hi, this is probably not the correct group for this post, but it's kinda related. Does anyone know of a report writer/generator that works for postgres? It would be nice if it is natively built in or some 3rd party tool that I can use. Would appreciate any info. regards, Hilkiah

[SQL] Bit Mapping operation

2001-06-12 Thread Najm Hashmi
Hi all, I am just wondering if bit map operations are possible in pl/pgsql.  We are storing sixteen different  (one or many ... i.e. check boxes ) choices in a  small int. For data cruchinging reasons, we need to reverse  the process to find out what what fields where selected or checked. Is this

[SQL] sum of string columns, why ?

2001-06-12 Thread Marcos Vaz - \( NewAge Group \)
I have one table with thwo columns, user and text, why sum all the text fields of the one user ? i need this. thank you Marcos ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl

[SQL] need help please on triggers..

2001-06-12 Thread Postgresql
Hi, How to create a foreign key in postgresql ? need triggers ? Thanks, Fred ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Help datetime

2001-06-12 Thread Tubagus Nizomi
i have problem in datetime my_table (start_date datetime,stop_date datetime); insert into my_table values ('Sun May 13 16:19:27 2001 JAVT','Sun May 13 14:06:13 2001 JAVT') select stop_date-start_date from my_table the result is "@ 2 hours 13 mins 14 secs" but i want result in minutes(integer) n

[SQL] update from another table

2001-06-12 Thread ivan
dear sir, i would like to know how can i update a table with columns from another table and adding a new column with a secuence, i have try update table set column = (select column from table2), .., set column=secuence.. is it right? thanks ivan ---(end of

[SQL] Function returning record

2001-06-12 Thread Alla
Is it possible in PostgreSQL to write a function that would return a record type. What I need is something like this: create function my_func(varchar) return record as ' declare my_rec record; begin select null as field1, null as field2 into my_rec; some processing to populat

[SQL] Re: multiple sql update w/ major time issues

2001-06-12 Thread Hans-Jürgen Schönig
Dawn schrieb: > I have a sql update statement that is dealing with hundreds of > thousands of records. It takes hours and hours to complete (if it > does complete and not take down the server). Here is how I have it > right now: > > update aud_member_ext_attributes b > set EXTVALUE217 = >

Re: [SQL] cascading delete - recursivity

2001-06-12 Thread Stephan Szabo
On Sat, 9 Jun 2001, Postgresql wrote: > Hi, > > I have a table of categories (it's pseudo-sql...) : > > CATEGORIES > ( > id_category PRIMARY KEY, > id_category_parent (FOREIGN KEY ? CONSTRAINT ??) , > cat_text > ) > > There is recursivity : id_category_parent is -1 (= no parent cat

[SQL] listing foreign keys

2001-06-12 Thread David Brown
is there any way to view the existing foreign keys in a database schema? ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[SQL] Do I have to lock table in this case?

2001-06-12 Thread Ondrej Palkovsky
I have a table like this: id primary key unique I need to do: - if 'unique' exists in table, return appropriate id else insert into table new id. Now doing: select id where unique=%s insert/update creates a race condition. The application can theoretically rollback & redo the whole transacti

Re: [SQL] Foreign key to base table with rows in inherited tables

2001-06-12 Thread Stephan Szabo
Yes, you cannot currently do this. Check past discussions on mailing lists for more details. Inheritance and constraints is pretty dodgy right now (for instance, Reservationfile.datafileNr is not unique). On Tue, 5 Jun 2001, Mikael Kjellström wrote: > I've declared a foreign key in table File

Re: [SQL] rpt

2001-06-12 Thread Chris Ruprecht
Hilkiah, you could use any report writing tool which connects to databases via ODBC. Download the Windows ODBC driver and install it. Set the '-i' flag on the postmaster, set up the ODBC interface to PostGreSQL in Windows and you're ready to fly :). Best regards, Chris - Original Message --

[SQL] Re: UPDATE with concatenate

2001-06-12 Thread Rene Pijlman
[EMAIL PROTECTED] (Laurent Patureau) schreef: >UPDATE table SET col .= '$val' Try: UPDATE table set col = col || '$val' http://www.postgresql.org/idocs/index.php?functions-string.html -- Vriendelijke groet, René Pijlman <[EMAIL PROTECTED]> Wat wil jij leren? http://www.leren.nl/ -

Re: [SQL] Getting row with id=max(id)

2001-06-12 Thread jeff
> A related question is: is there a way to time a query in psql, like the > client of MySQL does? use the explain commmand explain select * from foo; > > > ---(end of broadcast)--- > TIP 2: you can get off all lists at once with the unregister co

Re: [SQL] PL/PGSQL

2001-06-12 Thread Roberto Mello
On Tue, Jun 05, 2001 at 08:18:03AM +0200, Andrzej Roszkowski wrote: > Hi! > I can't find any info about possible data types that can be returned from > procedure. I want to return tuple. When I use OPAQUE as a return type I > get error message that OPAQUE can be only returned from trigger. It is >

[SQL] Re: Bit Mapping operation

2001-06-12 Thread Philip Hallstrom
In 7.1 it's there... using the |(or) &(and), etc.. operators. In 7.0.3 it's not although can be added easily. example: test=> select 2 | 1; ?column? -- 3 (1 row) test=> select 2 & 1; ?column? -- 0 (1 row) test=> select 3 & 1; ?column? -- 1 (1

[SQL] Inheritance - Multiple membership

2001-06-12 Thread Jimmie Fulton
This question was asked in 1998 on this list by someone else, but did not appear to be answered... Say I have a tbl_person. tbl_teacher and tbl_student both inherit from tbl_person and each have their own extended attributes. Is it possible for a person in tbl_person to be both a teacher at the

Re: [SQL] multiple sql update w/ major time issues

2001-06-12 Thread Tom Lane
[EMAIL PROTECTED] (Dawn) writes: > I have a sql update statement that is dealing with hundreds of > thousands of records. It takes hours and hours to complete (if it > does complete and not take down the server). No wonder, if you write it like that. You're forcing a fresh select from gl_totals

Re: [SQL] Integrity reference and inheritance

2001-06-12 Thread Christophe Labouisse
Sorry for the double post, I messed up in my addresses. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Cluster and primary key

2001-06-12 Thread Mathijs Brands
On Tue, Jun 05, 2001 at 07:51:11AM +, Mikael Kjellström allegedly wrote: > I can't find a way to cluster a table on another index and keep it's > primary key. > > When I define the table the primary key is created, but it's dropped when I > cluster the table on another index. > > I've trie

[SQL] Are SQL commands "atomic" ?

2001-06-12 Thread Gerald Gutierrez
I'm using 7.1.1 right now, and have the following table: id | s +--- 1 | alpha 2 | beta 3 | gamma 4 | delta (4 rows) I'd like to switch the id of "beta" to 3 and the id of "gamma" to 2 ("flip" them). Since id is the PK, it must remain unique and so I can't just set the

[SQL] How to store a linked list in a RDBMS

2001-06-12 Thread Srikanth Rao
I have a linked list representing a tree. How do I store it in the database? Does PGSQL give us any special procedures to deal with such structures? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://pers

Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Standards

2001-06-12 Thread ANDREW PERRIN
Interesting - my experience is that Access, at least, generally treats NULL's correctly: (This was done under Access 2000): create table foo (name text(20)) insert into foo values ("bar"); insert into foo values ("bar"); insert into foo values ("bar"); insert into foo values ("bar"); insert into