Re: [GENERAL] Question about indexes.
> This table has no indexes at all. Each query made (using EXPLAIN) reveals a > "Seq Scan". > So far, everything is OK. > Then I define 2 indexes, one affects a varchar field, for example 'lastname' > an the other a float type field, let´s call it 'id'. > When I perform a query such as SELECT * FROM table WHERE lastname = > 'Douglas', EXPLAIN reveals that index is being used ("Index Scan"). > But when the query is like: SELECT * FROM table WHERE id = 10, no index is > used, a "Seq Scan" is made. So it looks like if an index defined on a > numeric type field, doesn't work. (same thing happens with an index on > integer field). > Finally I made the index on 'id' field CLUSTERED. Repeating the query using > EXPLAIN I get a lower cost and "Index Scan". i found a similar problem with 6.5beta, only i was using index fields of int8, float8, datestamp and abstime. be nice to know what the issue is. jim (wandering off to look up "CLUSTERED") -- [ Jim MercerReptilian Research [EMAIL PROTECTED] +1 416 410-5633 ] [ The telephone, for those of you who have forgotten, was a commonly used ] [ communications technology in the days before electronic mail.] [ They're still easy to find in most large cities. -- Nathaniel Borenstein ]
[GENERAL] Question about indexes.
Postgres Version : 6.5 (beta) I have a table with 53411 rows. This table has no indexes at all. Each query made (using EXPLAIN) reveals a "Seq Scan". So far, everything is OK. Then I define 2 indexes, one affects a varchar field, for example 'lastname' an the other a float type field, let´s call it 'id'. When I perform a query such as SELECT * FROM table WHERE lastname = 'Douglas', EXPLAIN reveals that index is being used ("Index Scan"). But when the query is like: SELECT * FROM table WHERE id = 10, no index is used, a "Seq Scan" is made. So it looks like if an index defined on a numeric type field, doesn't work. (same thing happens with an index on integer field). Finally I made the index on 'id' field CLUSTERED. Repeating the query using EXPLAIN I get a lower cost and "Index Scan". The same test was made after deleting all records from the table and adding a few ones (for example 100). This time a "non-clustered" index defined on 'id' field worked fine. Is there an explanation of this behaviour? Thanks in advance. Spolar Alejandro.
[GENERAL] Embedded SQL in 'C' (cursors)
Does anyone know how to open a cursor for 'C" ..? I have checked the previous postings but cannot locate the proper syntax here is a snipit : void ShowTable_type(){ EXEC SQL BEGIN DECLARE SECTION; char *Atid; // variables to retrieve the table info char *Adesc; EXEC SQL END DECLARE SECTION; EXEC SQL CONNECT 'nathan'; EXEC SQL DECLARE lets_get_tid CURSOR FOR SELECT type.tid; printf("Choose the TID to delete\n\n \n"); do{ EXEC SQL OPEN lets_get_tid; EXEC SQL FETCH lets_get_tid INTO //line 255 :Atid; printf("%s",Atid); }while(SQLCODE != SQLEND); EXEC SQL CLOSE lets_get_tid; } What am I doing wrong ..? here what happens when I rund ecpg : ecpg 4sql.c -o 4comp.c 4sql.c:124: parse error make: *** [sql] Error 255 Please if anyone has any ideas please let me know. Thank you Nathan
[GENERAL] Re: Weird: attribute 'input' not found
Gah! I had:
[GENERAL] Weird: attribute 'input' not found
The error message: PostgreSQL query failed: ERROR: attribute 'input' not found in ... on line 40 Normally I would think I just mis-typed a field name, but the word 'input' is *NOT* anywhere in the query. Honest. I spit it out before pg_exec() just to be sure. I even spit it out after to make sure it doesn't somehow get trashed by pg_exec or something. This is version 6.3.2, and I've been doing the same sort of code for months and months now. So far as I know, my ISP hasn't done anything weird lately, and all the rest of the database stuff is working flawlessly. The *really* weird thing is my code looks like this: if (isset($update)){ $query = "update ... where id = $id"; echo $query; } if (isset($id)){ $query = "select ... where id = $id"; /* Line 40 below */ pg_exec($connection, $query); . . . } Now, when $update is set, I get the error message. When it's not, I don't, and I get exactly what I expect. And I checked. The query is the SAME. So, what other condition could possibly generate this message? Any ideas?... -- "TANSTAAFL" Rich [EMAIL PROTECTED] webmaster@ and www. all of: R&B/jazz/blues/rock - jademaze.com music industry org - chatmusic.com acoustic/funk/world-beat - astrakelly.com sculptures - olivierledoux.com my own nascent company - l-i-e.com cool coffeehouse - uncommonground.com
Re: [GENERAL] Parallelizing PostgreSQL for Cluster
Dustin Sallings wrote: > > On Thu, 3 Jun 1999, The Hermit Hacker wrote: > > # One of the long-term projects that PostgreSQL, Inc is planning on > # working on is exactly this, unless someone jumps at it before we get a > # chance to... > > It should be a trivial change, right? :) Will it make it into 6.5? :) > > # On Thu, 3 Jun 1999, Laurence Liew wrote: > # > # > Hi! > # > > # > Is anyone looking at making postgreSQL scalable across a cluster of PCs? > # > That is, we have postgreSQL exuting queries which can be parallelised across > # > a cluster, either something along Informix's method of fragmenting the > # > tables across multiple disks, or Oracle's method of using a shared disk > # > (global file)architecture. > # > > # > It would be interesting to have PostrgreSQL sitting on a Beowulf cluster > # > giving Informix XPS or Oracle OPS a run for their money :-) > # > > # > Thanks for any info. > # > > # > Laurence > # > > # > > # > > # > > # > # Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy > # Systems Administrator @ hub.org > # primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org > # > # > # > > -- > SA, beyond.com My girlfriend asked me which one I like better. > pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <[EMAIL PROTECTED]> > |Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE > L___ I hope the answer won't upset her.
Re: [GENERAL] Implementing hierarchy
Rob Walker writes: > > I am trying to write code to access a product catalog (more as a learning > > exercise than anything else) and need to implement some sort of searchable > > hierarcy. For example: > > > > Computer Hardware (toplevel) > >Hard Drives > > Internal > > SCSI > > Fast SCSI > > Wide SCSI > > SCA > > > > Assuming these 'categories' are all in the same table as follows: > > > > prkey (primary key) > > descr varchar > > parent (for subcategories, toplevel parent is 0) > > I don't know if there is a 'right' way to do this, but I have done something > similar having an extra table that contains a tuple listing (node, ancestor) > pairs. This is kept in sync with the main table using a couple of triggers. > The code is at the end > > A sequence is used for the primary key in the main table, and the hierarchy > is then implicit since you can't create a child before the parent (at least > my application doesn't let you move an existing child to another parent). Here is a web page that may help. It explains something along the same lines. http://www.dbmsmag.com/9809d05.html -- Patrick D. Loganmailto:[EMAIL PROTECTED]
Re: [GENERAL] RE: [PORTS] AIX-4.2.1 binaries ? more info. PLEASE
Kapoor, Nishikant X said ... > > Well, after a 'make distclean' and a ./configure, the gettimeofday() error > went away. Infact, the ./configure showed that gettimeofday() neeeded two > arguments. BUT, the compilation error is still there and I'm still hoping > that some expert should be able to help me get through this. The compile error you are getting below is due to a missing header. More correctly 'configure' has mis-identified that your system has the endian.h header file. If you are using xlc for the compiler, then use the following configure command: ./configure --with-template=aix_42 --with-CC=xlc --with-CXX=xlC Be sure and do a 'make distclean' first! I just did a build using the above configure. Mind you, I'm using IBM's XLC compiler, not GCC (we don't have GCC on our system). IMPORTANT: before doing the configure above, change the template/aix_42 file to have the following line: YFLAGS:-d -Nm7 AIX's yacc needs a larger memory array to process the parser grammers. If you are using GNU's bison or byacc, then don't make the modification above. AIX's lex can't handle src/interfaces/ecpg/preproc/ecpg.l. Suggest you get and install flex instead. Something else to considder. I've seen various problems compiling the C++ stuff and since I don't use C++ I usually configure with "--without-CXX". BTW, the output below looks like you used the 'aix_gcc" template, not the 'aix_42' one. Be sure of which one you are using. > ./configure --with-template=aix_42 : > -- > gmake -C libpq all > gmake[2]: Entering directory > `/usr/local/src/postgresql-6.3.2/src/backend/libpq' > gcc -I../../include -I../../backend -fsigned-chars -Wall > -Wmissing-prototypes -I.. > -c be-dumpdata.c > gcc -I../../include -I../../backend -fsigned-chars -Wall > -Wmissing-prototypes -I.. > -c be-fsstubs.c > gcc -I../../include -I../../backend -fsigned-chars -Wall > -Wmissing-prototypes -I.. > -c be-pqexec.c > gcc -I../../include -I../../backend -fsigned-chars -Wall > -Wmissing-prototypes -I.. > -c pqcomprim.c > pqcomprim.c:20: endian.h: No such file or directory > gmake[2]: *** [pqcomprim.o] Error 1 > gmake[2]: Leaving directory > `/usr/local/src/postgresql-6.3.2/src/backend/libpq' > gmake[1]: *** [libpq.dir] Error 2 > gmake[1]: Leaving directory `/usr/local/src/postgresql-6.3.2/src/backend' > gmake: *** [all] Error 2 > > Thanks and still waiting for some help. > Nishi > > > Quick question, but did you doa 'make distclean' before you various > > ./configure's? > > > > > > > > On Tue, 1 Jun 1999, Kapoor, Nishikant X wrote: > > > > > I have used following different configurations for compilation but > > without > > > luck. Can someone PLEASE help me compile it. > > > > > > Version 6.4.2: > > > > > > ./configure --with-template=aix_gcc - following compilation error > > > ./configure --with-template=aix_42 - same compilation error > > > ./configure --with-template=aix_42 --with-CC=xlc - same compilation > > error > > > > > > postgres.c: In function `PostgresMain': > > > postgres.c:987: warning: implicit declaration of function `strcasecmp' > > > postgres.c: In function `ResetUsage': > > > postgres.c:1705: too few arguments to function `gettimeofday' > > > postgres.c:1702: warning: unused variable `tz' > > > postgres.c: In function `ShowUsage': > > > postgres.c:1720: too few arguments to function `gettimeofday' > > > postgres.c:1716: warning: unused variable `tz' > > > gmake[2]: *** [postgres.o] Error 1 > > > gmake[2]: Leaving directory > > > `/usr/local/src/postgresql-6.4.2/src/backend/tcop' > > > gmake[1]: *** [tcop.dir] Error 2 > > > gmake[1]: Leaving directory > > `/usr/local/src/postgresql-6.4.2/src/backend' > > > gmake: *** [all] Error 2 > > > > > > Just wondering, why do I still see gcc when I have it configured with > > > "--with-CC=xlc" ? > > > Could it be because I am using 'gmake all' and not 'make all' ? I tried > > > 'make all' but got the following message: > > > > > > wsvr:/usr/local/src/postgresql-6.4.2/src:postgres> make all > > > You must use GNU make to use Postgres. It may be installed > > > on your system with the name 'gmake'. > > > > > > NOTE: If you are sure that you are using GNU make and you are > > >still getting this message, you may simply need to run > > >the configure program. > > > > > > and so, ended up doing 'gmake all'. > > > > > > Version 6.3.2: > > > > > > And on the same machine i.e. IBM PowerPC with AIX-4.2.1, compiling 6.3.2 > > > gives following error: > > > > > > ./configure --with-template=aix-gcc - following error > > > > > > gmake -C libpq all > > > gmake[2]: Entering directory > > > `/usr/local/src/postgresql-6.3.2/src/backend/libpq' > > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > > -Wmissing-prototypes -I.. -c be-dumpdata.c -o be-dumpdata.o > > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > > -
Re: [GENERAL] Parallelizing PostgreSQL for Cluster
On Thu, 3 Jun 1999, The Hermit Hacker wrote: # One of the long-term projects that PostgreSQL, Inc is planning on # working on is exactly this, unless someone jumps at it before we get a # chance to... It should be a trivial change, right? :) # On Thu, 3 Jun 1999, Laurence Liew wrote: # # > Hi! # > # > Is anyone looking at making postgreSQL scalable across a cluster of PCs? # > That is, we have postgreSQL exuting queries which can be parallelised across # > a cluster, either something along Informix's method of fragmenting the # > tables across multiple disks, or Oracle's method of using a shared disk # > (global file)architecture. # > # > It would be interesting to have PostrgreSQL sitting on a Beowulf cluster # > giving Informix XPS or Oracle OPS a run for their money :-) # > # > Thanks for any info. # > # > Laurence # > # > # > # > # # Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy # Systems Administrator @ hub.org # primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org # # # -- SA, beyond.com My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <[EMAIL PROTECTED]> |Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L___ I hope the answer won't upset her.
Re: [GENERAL] PL/pgSQL help
On 3 Jun 1999, Anatoly K. Lasareff wrote: # Yes. 'serial' type implements as 'int' type for field and sequence, # which mane is __seq. So you can do this: # # INSERT into Network (parentID, networkName) values (pid, mname); netid # := Network_networkID_seq.last_value; That doesn't tell you the last value you added, that tells you the last value that was added at all. currval('network_networkid_seq') tells you the last one you added. -- SA, beyond.com My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <[EMAIL PROTECTED]> |Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L___ I hope the answer won't upset her.
[GENERAL] Re: PostgreSQL Install
I'm forwarding this to the general list, as I haven't used an hp-unix box before. Peter On Wed, 2 Jun 1999, GTI wrote: > Hi > I am about to install a PostgreSQL version (6.4.2) on a hp-unix machine. > My GNU C++ compiler is version 2.8.1, and has been tested so that I know it works. > Prior to installation, I must configure the source of PostgreSQL using ./configure >[options], > but upon configuration I get the following error message as > >CC compiler cannot create executables. > > Do you know what the problem might be and how to solve it? Do you know anyone who > can help me to solve this problem ? > > I appreciate your help. > Sincerely > George Titan > -- Peter T Mount [EMAIL PROTECTED] Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf
RE: [GENERAL] RE: [PORTS] AIX-4.2.1 binaries ? more info. PLEASE !
Well, after a 'make distclean' and a ./configure, the gettimeofday() error went away. Infact, the ./configure showed that gettimeofday() neeeded two arguments. BUT, the compilation error is still there and I'm still hoping that some expert should be able to help me get through this. ./configure --with-template=aix_42 : -- gmake -C libpq all gmake[2]: Entering directory `/usr/local/src/postgresql-6.3.2/src/backend/libpq' gcc -I../../include -I../../backend -fsigned-chars -Wall -Wmissing-prototypes -I.. -c be-dumpdata.c gcc -I../../include -I../../backend -fsigned-chars -Wall -Wmissing-prototypes -I.. -c be-fsstubs.c gcc -I../../include -I../../backend -fsigned-chars -Wall -Wmissing-prototypes -I.. -c be-pqexec.c gcc -I../../include -I../../backend -fsigned-chars -Wall -Wmissing-prototypes -I.. -c pqcomprim.c pqcomprim.c:20: endian.h: No such file or directory gmake[2]: *** [pqcomprim.o] Error 1 gmake[2]: Leaving directory `/usr/local/src/postgresql-6.3.2/src/backend/libpq' gmake[1]: *** [libpq.dir] Error 2 gmake[1]: Leaving directory `/usr/local/src/postgresql-6.3.2/src/backend' gmake: *** [all] Error 2 Thanks and still waiting for some help. Nishi > Quick question, but did you doa 'make distclean' before you various > ./configure's? > > > > On Tue, 1 Jun 1999, Kapoor, Nishikant X wrote: > > > I have used following different configurations for compilation but > without > > luck. Can someone PLEASE help me compile it. > > > > Version 6.4.2: > > > > ./configure --with-template=aix_gcc - following compilation error > > ./configure --with-template=aix_42 - same compilation error > > ./configure --with-template=aix_42 --with-CC=xlc - same compilation > error > > > > postgres.c: In function `PostgresMain': > > postgres.c:987: warning: implicit declaration of function `strcasecmp' > > postgres.c: In function `ResetUsage': > > postgres.c:1705: too few arguments to function `gettimeofday' > > postgres.c:1702: warning: unused variable `tz' > > postgres.c: In function `ShowUsage': > > postgres.c:1720: too few arguments to function `gettimeofday' > > postgres.c:1716: warning: unused variable `tz' > > gmake[2]: *** [postgres.o] Error 1 > > gmake[2]: Leaving directory > > `/usr/local/src/postgresql-6.4.2/src/backend/tcop' > > gmake[1]: *** [tcop.dir] Error 2 > > gmake[1]: Leaving directory > `/usr/local/src/postgresql-6.4.2/src/backend' > > gmake: *** [all] Error 2 > > > > Just wondering, why do I still see gcc when I have it configured with > > "--with-CC=xlc" ? > > Could it be because I am using 'gmake all' and not 'make all' ? I tried > > 'make all' but got the following message: > > > > wsvr:/usr/local/src/postgresql-6.4.2/src:postgres> make all > > You must use GNU make to use Postgres. It may be installed > > on your system with the name 'gmake'. > > > > NOTE: If you are sure that you are using GNU make and you are > >still getting this message, you may simply need to run > >the configure program. > > > > and so, ended up doing 'gmake all'. > > > > Version 6.3.2: > > > > And on the same machine i.e. IBM PowerPC with AIX-4.2.1, compiling 6.3.2 > > gives following error: > > > > ./configure --with-template=aix-gcc - following error > > > > gmake -C libpq all > > gmake[2]: Entering directory > > `/usr/local/src/postgresql-6.3.2/src/backend/libpq' > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > -Wmissing-prototypes -I.. -c be-dumpdata.c -o be-dumpdata.o > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > -Wmissing-prototypes -I.. -c be-fsstubs.c -o be-fsstubs.o > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > -Wmissing-prototypes -I.. -c be-pqexec.c -o be-pqexec.o > > gcc -I../../include -I../../backend -fsigned-chars -Wall > > -Wmissing-prototypes -I.. -c pqcomprim.c -o pqcomprim.o > > pqcomprim.c:20: endian.h: No such file or directory > > gmake[2]: *** [pqcomprim.o] Error 1 > > gmake[2]: Leaving directory > > `/usr/local/src/postgresql-6.3.2/src/backend/libpq' > > gmake[1]: *** [libpq.dir] Error 2 > > gmake[1]: Leaving directory > `/usr/local/src/postgresql-6.3.2/src/backend' > > gmake: *** [all] Error 2 > > > > > Hi Nishi, > > > > > > > Here is the exact error I got when I compiled it on my IBM PowerPC > > > running > > > > AIX-4.2.1. > > > > > > > > ./configure --prefix=/usr/local/pgsql_6_4 --with-template=aix_42 : > > > > > > If you are going to build with GCC, then you should use the aix_gcc > > > template, not the aix_42 template. aix_42 is for building with IBM's > xlC > > > compiler. > > > > > > Not sure why you're getting too few arguments for gettimeofday(). > This > > > function only takes 1 or 2 parameters (depending on the > implementation; > > > AIX takes two) Suggest you use the xlC compiler (configure option > > > --with-CC=xlc) if available. > > > > > > > gcc -I../../include -I../../backend -qch
Re: [GENERAL] PL Problems.
> tt=> create table test (a int4, b bit2); > CREATE > tt=> CREATE FUNCTION mytrig () RETURNS opaque AS > ' > tt-> ' > tt'> DECLARE > tt'> def_state CONSTANT BIT2 := 'b0001'::BIT2; > tt'> BEGIN > tt'> new.b = def_state; > tt'> RETURN new; > tt'> END; > tt'> ' LANGUAGE 'plpgsql'; > ERROR: parser: parse error at or near "b0001" > tt=> > Aaaah, Stupidity! I need double quotes around the strings, i.e. ''b0001'' Sorry for the bandwith. BTW, is their interest in having a 2 byte bit type as a contributed type along the lines of int8? I could package it up, and post it. It supports all the binary operations, i.e. & | ^ ~ << and >>. Only problem I would like to resolve is why I cannot define the or operator as |. Adriaan
[GENERAL] PL Problems.
I have my marvelous bit type working now, and now I find out I cannot use it in PL scripts. tt=> create table test (a int4, b bit2); CREATE tt=> CREATE FUNCTION mytrig () RETURNS opaque AS ' tt-> ' tt'> DECLARE tt'> def_state CONSTANT BIT2 := 'b0001'::BIT2; tt'> BEGIN tt'> new.b = def_state; tt'> RETURN new; tt'> END; tt'> ' LANGUAGE 'plpgsql'; ERROR: parser: parse error at or near "b0001" tt=> I've tried all combinations I could think of, always with the same result. Is this a restriction in PL? I would have thought that the types are simply looked up in the systems tables, or do I have to do something else? Any help greatly appreciated! Even if only to tell me that this doesn't work in which case I can convert back to using integers. Cheers, Adriaan
Re: [GENERAL] Implementing hierarchy
> I am trying to write code to access a product catalog (more as a learning > exercise than anything else) and need to implement some sort of searchable > hierarcy. For example: > > Computer Hardware (toplevel) >Hard Drives > Internal > SCSI > Fast SCSI > Wide SCSI > SCA > > Assuming these 'categories' are all in the same table as follows: > > prkey (primary key) > descr varchar > parent (for subcategories, toplevel parent is 0) I don't know if there is a 'right' way to do this, but I have done something similar having an extra table that contains a tuple listing (node, ancestor) pairs. This is kept in sync with the main table using a couple of triggers. The code is at the end A sequence is used for the primary key in the main table, and the hierarchy is then implicit since you can't create a child before the parent (at least my application doesn't let you move an existing child to another parent). Rob --- CREATE TABLE places ( id INT4 DEFAULT NEXTVAL('places_seq') PRIMARY KEY, nameTEXT NOT NULL, parent INT4 DEFAULT 0 ); CREATE TABLE places_tree ( placeINT4, ancestor INT4, PRIMARY KEY (place, ancestor) ); CREATE FUNCTION explode_place () RETURNS OPAQUE AS ' DECLARE row places_tree%ROWTYPE; BEGIN FOR row IN SELECT * FROM places_tree WHERE place = NEW.parent LOOP INSERT INTO places_tree VALUES (NEW.id, row.ancestor); END LOOP; IF NEW.parent <> 0 THEN INSERT INTO places_tree VALUES (NEW.id, NEW.parent); END IF; RETURN NEW; END; ' LANGUAGE 'plpgsql'; CREATE FUNCTION implode_place () RETURNS OPAQUE AS ' DECLARE row places_tree%ROWTYPE; BEGIN DELETE FROM places_tree WHERE place = OLD.id; FOR row IN SELECT * FROM places_tree WHERE ancestor = OLD.id LOOP DELETE FROM places WHERE id = row.place; END LOOP; RETURN OLD; END; ' LANGUAGE 'plpgsql'; CREATE TRIGGER explode_place_trigger AFTER INSERT ON places FOR EACH ROW EXECUTE PROCEDURE explode_place(); CREATE TRIGGER implode_place_trigger BEFORE DELETE ON places FOR EACH ROW EXECUTE PROCEDURE implode_place();
[GENERAL] MSysConf grief
Hello, I am trying to link to a Postgres table from MS Access using the insight ODBC driver (6.40.0004). When I try to link I get the following error: The servers MsysConf exists but is in an incorrect format. This used to work before. Strangely enough this works with NT, same driver. Any ideas, Regards Lincoln -- -- Lincoln Spiteri Manufacturing Systems STMicroelectronics, Malta e-mail: [EMAIL PROTECTED] --
Re: [GENERAL] PL/pgSQL help
> MH> Question 2: > MH> is there a way to get the value of the newly assigned primary key > MH> after an insert? (rather then following the insert with a select) > > MH> e.g. (this would be nice if it worked (networkID is the PKey)) > MH> INSERT into Network (parentID, networkName) values (pid, mname); > MH> netid := new.networkID; > >Yes. 'serial' type implements as 'int' type for field and sequence, >which mane is __seq. So you can do this: > >INSERT into Network (parentID, networkName) values (pid, mname); >netid := Network_networkID_seq.last_value; Just so I can clarify this, does it work "multi-user". eg if this was the sequence of events: user 1: INSERT into Network (parentID, networkName) values (pid1, mname1); user 2: INSERT into Network (parentID, networkName) values (pid2, mname2); user 1: netid1 := Network_networkID_seq.last_value; would user 1 be given the correct id value? (assuming we maintain the connection). btw, I'm using java for my midleware cheers timj [EMAIL PROTECTED]
Re: [GENERAL] Parallelizing PostgreSQL for Cluster
One of the long-term projects that PostgreSQL, Inc is planning on working on is exactly this, unless someone jumps at it before we get a chance to... On Thu, 3 Jun 1999, Laurence Liew wrote: > Hi! > > Is anyone looking at making postgreSQL scalable across a cluster of PCs? > That is, we have postgreSQL exuting queries which can be parallelised across > a cluster, either something along Informix's method of fragmenting the > tables across multiple disks, or Oracle's method of using a shared disk > (global file)architecture. > > It would be interesting to have PostrgreSQL sitting on a Beowulf cluster > giving Informix XPS or Oracle OPS a run for their money :-) > > Thanks for any info. > > Laurence > > > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org
[GENERAL] Parser or documentation bug?
Hi, I'm trying to define a new bit type with a length of two bytes, and to define a set of operators on this type. I've hit the following problem: I cannot define a | operator, as the parser doesn't like it. tt=> drop operator | (Bit2,Bit2); ERROR: parser: parse error at or near "|" tt=> create operator | ( leftarg = Bit2, rightarg = Bit2, procedure = bit2or ); ERROR: parser: parse error at or near "|" If I use || it works. So either the man page or the parser are at fault here. I'm currently using the snapshot from last Friday. I can also do a create by enclosing the | in double-quotes, as in "|", but I cannot use it, and I cannot drop it. Cheers, Adriaan
Re: [GENERAL] PL/pgSQL help
> "MH" == Mike Haberman <[EMAIL PROTECTED]> writes: MH> I'm a bit new to plpgsql, so this may be an easy question, MH> I've got a function (see below) that inserts into 3 different MH> tables. Each table has a SERIAL type for it's primary key. MH> Question 1: MH> I want to group all 3 inserts as a transacation. MH> but when I put BEGIN WORK and COMMIT I get the error (at run time): Really this is compile time for your function: its text compiles when it is first time called. MH> NOTICE: plpgsql: ERROR during compile of easy_add near line 21 MH> ERROR: parse error at or near "" MH> this is the line with COMMIT on it; MH> What am i doing wrong? MH> Also, do I also need to specify a ROLLBACK if any of the inserts fail? Any transaction operators, such as 'commit', 'rollback', etc not allowed in 'plpgsql' functions. Only function _call_ as a unit can be into transaction block. MH> Question 2: MH> is there a way to get the value of the newly assigned primary key MH> after an insert? (rather then following the insert with a select) MH> e.g. (this would be nice if it worked (networkID is the PKey)) MH> INSERT into Network (parentID, networkName) values (pid, mname); MH> netid := new.networkID; Yes. 'serial' type implements as 'int' type for field and sequence, which mane is __seq. So you can do this: INSERT into Network (parentID, networkName) values (pid, mname); netid := Network_networkID_seq.last_value; -- Anatoly K. Lasareff Email: [EMAIL PROTECTED] Senior programmer
[GENERAL] reatedb: database creation failed on mydb
Hi! I'm a new member and new to postgres. beside postgrest user I would also want my student to create their own database in their own home directory. first I issue (under postgrest user) createuser user_id then under that user_id I run initlocation ~/sql/data then I run createdb -D ~/sql/data mydb at this stage I get an error msg as below: ERROR: Unable to create database directory ~/sql/data/base/mydb createdb: database creation failed on mydb. what should I do now? I tried to find it in archives but i can't find it. FYI I'm using postgres v 6.3 running under RedHat. Thanks in advance.