[SQL] nobody user can't nextval('phone_id_seq')
Hi, Newbie needs help. I have a small web-based phonebook app using php and postgresql 7.02. It seems the nobody (apache) user can delete, update, add anything except increment the 'id' sequence. I don't think it's the code (cut and pasted from a tutorial) because the pgsql user can increment it. Any help appreciated. IanP -- "Dear someone you've never heard of, how is so-and-so. Blah blah. Yours truly, some bozo." - Homer Simpson ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] nobody user can't nextval('phone_id_seq')
On Sat, 14 Apr 2001, Ian Pulsford wrote: > Newbie needs help. I have a small web-based phonebook app using php and > postgresql 7.02. It seems the nobody (apache) user can delete, update, > add anything except increment the 'id' sequence. I don't think it's the > code (cut and pasted from a tutorial) because the pgsql user can > increment it. You need to grant access to the sequence. test=# \d foo Table "foo" Attribute |Type | Modifier ---+-+--- key | integer | not null default nextval('foo_key_seq'::text) name | varchar(40) | not null test=# GRANT ALL ON foo_key_seq TO nobody; CHANGE -- Tod McQuillin ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
[SQL] Re: enumerating rows
> Try this > > CREATE SEQUENCE just_a_seq; > Select nextval('just_a_seq') as row_no, * from pg_tables ; > drop SEQUENCE just_a_seq; Wow! Great idea! :-) In fact I need row numbering in browsing and printing invoices. They should be read on various platforms (Windows clients, generated HTML and printed reports made by Windows) and it would be good to unify the handling of enumeration. Of course, all clients can enumerate the result somehow, but it's hard to maintain the separate codes. Regards, Zoltan -- Kov\'acs, Zolt\'an [EMAIL PROTECTED] http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] Dropping users with no name
=?iso-8859-1?Q?Hans=2DJ=FCrgen=20Sch=F6nig?= wrote: >I have accidentally created a user with no name. How can I delete this >user? >I have compiled my attempts below: > >Hans > > >persons=# SELECT * FROM pg_user; > usename | usesysid | usecreatedb | usetrace | usesuper | usecatupd | >passwd | >valuntil >--+--+-+--+--+---+-- >+-- > > postgres | 26 | t | t| t| t | > | > | 27 | f | f| f| f | > | >(2 rows) > >persons=# DELETE FROM pg_user where usesysid>26; >DELETE 0 pg_user is a view. Try DELETE FROM pg_shadow where usename = ''; -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "Be strong, and let your heart take courage, all you who hope in the Lord." Psalm 31:24 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [SQL] BOOLEAN data type?
"Josh Berkus" <[EMAIL PROTECTED]> writes: > Can someone explain this to me? Are you taking into account that SQL booleans are actually three-valued? They can be TRUE, FALSE, or NULL (NULL taken as meaning "don't know"). regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Bug in user management?
While we're on this subject, where is the documentation on pg_shadow? Specifically, what it 'usetrace' for? -Cedar On Fri, 13 Apr 2001, Tom Lane wrote: > =?iso-8859-1?Q?Hans=2DJ=FCrgen=20Sch=F6nig?= <[EMAIL PROTECTED]> writes: > > I have created a user called epi who is not allowed to create database > > but allowed to create users. > > The "CREATEUSER" option is rather badly mislabeled: the privilege it > actually grants is superuser status. You are laboring under a severe > misapprehension if you think that epi has ANY restrictions on what he > can do ... > > regards, tom lane ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
[SQL] Simple Question
Hello All, This may be the wrong mailing list for this question but I hope someone can answer it for me as it is holding up my development progress. I have now been able to compile the tutorial/complex.c functions and test them out with no problems. I made a copy of the Makefile, Makefile.global, and Makefile.port (Linux) from the tutorial directory and made a simple modification for the paths. Now the 'c" files compile up just fine. The problem is that this set up will not work if I make some C++ files. I think that there is something wrong in one of the above makefiles for the g++ compiler and the needed options, but do not know where to find it. I even made a copy of the "concat_text()" function from the manual and saved one copy as a "c" file. It compiled just fine. I then renamed that same file to "cc" for C++ and it compiled ok, but the psql command interperter gave me some error that it could not find the function even thout it worked the first time and I moade no other changes. I also need to link in some other libraries like "libfile.a" that I have for some of the functions that will be placed in my pgSQL interface but am not sure hoe to do this as well with the default Makefiles. Does someone have a simple Makefile that will allow me to compile up my C++ functions? Cheers, Lonnie __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] BOOLEAN data type?
Peter, > No way. You're doing something wrong. How about showing the data > that > makes you believe this? Hey, take it easy. It was only a technical question / potential issue. Not a personal criticism. Based on your implied assertion that the queries *should* be working in a Boolean fashion, I took them apart and re-built them ... and it turned out to be a data problem in a linked table (a unique index was dropped somehow without my awareness while altering the tables). So Booleans are working properly, and you can relax now. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small businessesfax 621-2533 and non-profit organizations. San Francisco ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] BOOLEAN data type?
Tom, > Are you taking into account that SQL booleans are actually > three-valued? > They can be TRUE, FALSE, or NULL (NULL taken as meaning "don't > know"). That turned out not to be the issue, but that's good information to have. I'll need to remember to make all of my BOOLEAN columns NOT NULL DEFAULT FALSE. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small businessesfax 621-2533 and non-profit organizations. San Francisco ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[SQL] g++ not working for postgresql extension languages?
Hi All again, One more thing that I have tried. If I now do a similar thing as in my previous message with the "funcs.c" file, but this time with the "funcs.cc" file then I can get: - [root@Treazurac /test]# g++ -I./include -I./backend -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I/usr/include/pgsql -I/usr/include -fpic -c -o funcs.o funcs.cc [root@Treazurac /test]# g++ -shared -o funcs.so funcs.o [root@Treazurac /test]# ls Makefile Makefile.global Makefile.port funcs.cc funcs.o funcs.so* funcs.sql [root@Treazurac /test]# pico -w funcs.sql [root@Treazurac /test]# psql -f funcs.sql -d trdata DROP CREATE [root@Treazurac /test]# psql trdata Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit trdata=# select concat_text('a','b'); ERROR: Can't find function concat_text in file /test/funcs.so trdata=# -- And although I should not be running as "root", this is a test machine and it is ok for the time being. If I do the same thing as above, but using the "funcs.c" file (which is the exact same file just renamed) --- funcs.c and funcs.cc - #include "postgres.h" // for variable length type #include #include #include #include #include // for unix crypt function text * concat_text(text *arg1, text *arg2); text * concat_text(text *arg1, text *arg2) { int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ; text *new_text = (text *) malloc(new_text_size); memset((void *) new_text, 0, new_text_size); VARSIZE(new_text) = new_text_size; strncpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ); strncat(VARDATA(new_text), VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ); return (new_text); } -- with funcs.sql -- DROP FUNCTION concat_text(text, text); CREATE FUNCTION concat_text(text, text) RETURNS text AS '/test/funcs.so' LANGUAGE 'c'; With the "funcs.c" file in place I get: - [root@Treazurac /test]# gcc -I./include -I./backend -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I/usr/include/pgsql -I/usr/include -fpic -c -o funcs.o funcs.c [root@Treazurac /test]# gcc -shared -o funcs.so funcs.o [root@Treazurac /test]# psql -f funcs.sql -d trdata DROP CREATE [root@Treazurac /test]# psql trdata Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit trdata=# select concat_text('a','b'); concat_text - ab (1 row) trdata=# - so now I do not understand why the "gcc" version works and the "g++" version does not? Just a side note in that I can easliy compile c++ the examples in the interfaces/libpq++ directory without any problems so that this is very strange to me. I really need the "g++" version to work correctly as well? Any ideas anyone? Cheers Lonnie __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] Full outer join
Tim Perdue <[EMAIL PROTECTED]> writes: > SELECT * > FROM (stats_http_downloads sh > FULL OUTER JOIN stats_ftp_downloads sf USING (day,filerelease_id)) ; > ERROR: FULL JOIN is only supported with mergejoinable join conditions I've committed a fix for this problem. It'll appear in 7.1.1, or you can grab CVS or a nightly snapshot if you are in a hurry. regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] Same question about PostgreSql
Hi group, We have a DSS system based on Informix IDS and number of OLTP systems based on Interbase. After we was running this system, we had have a unceasing serious problems with Interbase. 1) Massive inserts, updates, deletes is crashed database internal structure !!!. we have to make backup and restore every night ( backup and restore for 1G database is spent about 3 hours !!). 2) Garbage collection is crashed database internal structure !! 3) Backup sometimes can't process crashed database. 4) Restore frequently ( 50% of cases ) can't help ( because backup is not valid even if backup utility is finished without errors ( constraints violation and etc. ) ) OLTP database has about 300 tables and 250 store procedures. Number of client connections 100 and less. Maximum database size is about 1.5 G - 3 G. Data from the OLTP systems periodically come into DSS database. Excuse me for long entering. Finally questions. How stable is PostgreSql ? I know, PostgreSql doesn't support 'prepare ' operation, is it successful to use one for OLTP databases ? Thanks for responds. Good luck. Sergey. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [SQL] Same question about PostgreSql
>How stable is PostgreSql ? >I know, PostgreSql doesn't support 'prepare ' operation, is it successful to >use one for OLTP databases ? Speaking from experience, I have personally stress tested Postgres under loads of over 512 persistent connections with our LXP application server with zero problems. J > > >Thanks for responds. > >Good luck. > >Sergey. > > > > > > > >---(end of broadcast)--- >TIP 6: Have you searched our list archives? > >http://www.postgresql.org/search.mpl > -- -- CommandPrompt - http://www.commandprompt.com OpenDocs, LLC. - http://www.opendocs.org LinuxPorts - http://www.linuxports.com LDP - http://www.linuxdoc.org -- Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom. -- ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl