Re: [SQL] Problem in writing functions

2001-04-13 Thread Josh Berkus
Kris, > I am writing a function in postgresql which inserts a row into the > database, > but it is not working, can anybody help me out with a simple example. Please post your function. I'm sure the folks can take a crack at it. -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Bug in user management?

2001-04-13 Thread Tom Lane
=?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 labor

Re: [SQL] Savepoints

2001-04-13 Thread Bruce Momjian
> Does PostgreSQL currently support something like savepoints in Oracle? No, sorry, but we know we need them. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue +

[SQL] Problem in writing functions

2001-04-13 Thread Kris
Hi, I am writing a function in postgresql which inserts a row into the database, but it is not working, can anybody help me out with a simple example. thanx a lot. Kris. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the

[SQL] SELECT query

2001-04-13 Thread Sharmad Naik
I have three table called table1, table2, table3 all having fields like: table1 contain id and username and id referencing table4 table2 contains id and parallel_username and id referencing table4 table3 contains id and other_username and id referencing table4 table4 is the main table containing

[SQL] Re: enumerating rows

2001-04-13 Thread Luis C. Ferreira
Try this CREATE SEQUENCE just_a_seq; Select nextval('just_a_seq') as row_no, * from pg_tables ; drop SEQUENCE just_a_seq; > > row_no | column1 | column2 | ... > ---+-+-+ ... > 1 | datum11 | datum12 | ... > 2 | datum21 | datum22 | ... >... | ... | ..

[SQL] Savepoints

2001-04-13 Thread Hans-Jürgen Schönig
Does PostgreSQL currently support something like savepoints in Oracle? Hans ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

[SQL] Dropping users with no name

2001-04-13 Thread Hans-Jürgen Schönig
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 --+--+-+--+

[SQL] Bug in user management?

2001-04-13 Thread Hans-Jürgen Schönig
I need some information about PostgreSQL user management. I have created a user called epi who is not allowed to create database but allowed to create users. I have connected as user epi and have then created user kertal with the following command: shop=# CREATE USER kertal WITH PASSWORD 'anypass

[SQL] bound variables with PHP?

2001-04-13 Thread Phil Glatz
I haven't found away to use prepared statements with PHP4 and Postgres - any way to do so? I have an SQL statement I'd prefer to parse outside a loop, ala the prepare and exec statements of dbi. ---(end of broadcast)--- TIP 1: subscribe and unsu

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Lonnie Cumberland
Thanks for the code snippet Josh, I'll give this method a try as it is only for a simple listing and will not have to do too many things special. Cheers Lonnie --- Josh Berkus <[EMAIL PROTECTED]> wrote: > Lonnie, Tom: > > Here's a somewhat complicated example of what Tom's talking about from >

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Josh Berkus
Lonnie, Tom: Here's a somewhat complicated example of what Tom's talking about from my own programs. HOWEVER, you should use this kind of structure sparingly, if at all. SQL is a declarative language, rather than a procedural one. For updates to groups of records, you should put the updates

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Tom Lane
Lonnie Cumberland <[EMAIL PROTECTED]> writes: > Actually I have the need at different places in my functions to > sometimes work on the list items returned from a query and also have > the need to just work on the first result returned by a query. SELECT ... LIMIT 1 will serve the second need. F

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Lonnie Cumberland
Thanks for the info Tom, I found that same solution just after I had sent this message to the mailing list. I set up a RECORD variable that should receive the results, but the documentation is unclear as to if the variable will receive ALL of the results from the query of just the first result f

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Tom Lane
Lonnie Cumberland <[EMAIL PROTECTED]> writes: > I have then created a PL/pgSQL function called "register_user()" in a file > called register.sql > create function register_user(text,text,text,text,text,text,text,text,text) > [snip] > begin > -- Look to see if the login is already taken >

Re: [SQL] RE: RE: Re: select substr???

2001-04-13 Thread Tom Lane
Jeff Eckermann <[EMAIL PROTECTED]> writes: > You are correct, the check for "$1 is null" is not required. I was > attempting an optimisation, as in "don't do anything else if this is null". > The gain would depend on how much further processing the function would > attempt before recognizing that

Mailing list gripes (was Re: [SQL] Re: Maybe a Bug, maybe bad SQL)

2001-04-13 Thread Tom Lane
Louis-David Mitterrand <[EMAIL PROTECTED]> writes: > As if subject mangling and annoying footers were not enough. You can turn off subject mangling in your subscription preferences. If you haven't gone through majordomo's "help set" info recently, you might spend the time to do so --- there's a l

Re: [SQL] BOOLEAN data type?

2001-04-13 Thread Peter Eisentraut
Josh Berkus writes: > That the following query: > > SELECT detail_id FROM order_detials > WHERE order_usq = 7703 AND detail_required; > > ... should be equivalent to: > > SELECT detail_id FROM order_detials > WHERE order_usq = 7703 AND detail_required = TRUE; > > However, in testing (7.1 RC2), t

[SQL] BOOLEAN data type?

2001-04-13 Thread Josh Berkus
Folks: I had assumed that the BOOL column type was a tru boolean. That is, I wrote some functions on the understand that, given table def: CREATE TABLE order_details ( order_detail_id SERIAL NOT NULL PRIMARY KEY, detail_id INT4 NOT NULL, order_usq INT4 NOT NULL,

Re: [SQL] Debian Package problems

2001-04-13 Thread Roberto Mello
On Fri, Apr 13, 2001 at 11:38:18AM -0400, Stan Brown wrote: > I don;t have a clue. But I also am having fits with the Debian package for > "stable" It installs fine, and then I su to postgres. At that point in time > psql will connect, but createuser fails :-( > > I woul

Re: [SQL] 7.1 grant/revoke speed

2001-04-13 Thread Tom Lane
Kyle <[EMAIL PROTECTED]> writes: > Any reason why I should expect grants and/or revokes to be slower under > 7.1RC3? > I have a script that grants all our privileges and it takes about 5 to > 10 times longer to run than it did under 7.0.3. Seems unlikely that the problem is with the grants/revok

Re: [SQL] Full outer join

2001-04-13 Thread Tom Lane
Tim Perdue <[EMAIL PROTECTED]> writes: >> Is either of these tables actually a view? > Hehe - no. I sent the \d of both tables at the bottom of that email. \d isn't very helpful for these sorts of reports. How about pg_dump -s ? regards, tom lane --

Re: [SQL] Debian Package problems

2001-04-13 Thread Oliver Elphick
Roberto Mello wrote: >On Fri, Apr 13, 2001 at 09:00:45AM -0600, Roberto Mello wrote: > >>If I try to connect through psql, it asks me for the password again. >> It looks like it's using password auth instead of ident auth, which used >> to be the default. >>There's nothing poin

Re: [SQL] Full outer join

2001-04-13 Thread Tim Perdue
On Fri, Apr 13, 2001 at 11:11:26AM -0400, Tom Lane wrote: > Tim Perdue <[EMAIL PROTECTED]> writes: > > Does it still work with those revised CREATE statements? > > Yes, works fine here. > > >> What version are you using? > > > That's RC3 and RC1. > > Curious. I'd expect this to happen for col

Re: [SQL] Full outer join

2001-04-13 Thread Tom Lane
Tim Perdue <[EMAIL PROTECTED]> writes: > Does it still work with those revised CREATE statements? Yes, works fine here. >> What version are you using? > That's RC3 and RC1. Curious. I'd expect this to happen for column datatypes whose '=' operator isn't marked mergejoinable, but plain old int

Re: [SQL] Debian Package problems

2001-04-13 Thread Roberto Mello
On Fri, Apr 13, 2001 at 09:00:45AM -0600, Roberto Mello wrote: > If I try to connect through psql, it asks me for the password again. > It looks like it's using password auth instead of ident auth, which used > to be the default. > There's nothing pointed in the packages web pages, a

[SQL] Debian Package problems

2001-04-13 Thread Roberto Mello
Does anybody know what's going on with the Debian 7.1 RC4 packages? It will not let me create any users or even talk to the backend. If I try to create a user (as user postgres), it asks me for a password, but it's not the UNIX password because I tried that (I changed the password

[SQL] Re: Update

2001-04-13 Thread Kyle
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > It appears that the first function would get evaluated first under 7.0.3 > > but the last function gets evaluated first under 7.1. Is that accurate? > > Actually, I was under the impression that (all else being equal) WHERE > clauses would g

Re: [SQL] Full outer join

2001-04-13 Thread Tim Perdue
On Fri, Apr 13, 2001 at 03:02:32AM -0400, Tom Lane wrote: > Tim Perdue <[EMAIL PROTECTED]> writes: > > However, I keep getting this error, and I don't know what it means: > > ERROR: FULL JOIN is only supported with mergejoinable join conditions > > Works for me: > > regression=# create table st

Re: [SQL] Full outer join

2001-04-13 Thread Tom Lane
Tim Perdue <[EMAIL PROTECTED]> writes: > However, I keep getting this error, and I don't know what it means: > ERROR: FULL JOIN is only supported with mergejoinable join conditions Works for me: regression=# create table stats_http_downloads (day int, filerelease_id int); CREATE regression=# cr