Re: [SQL] plpgsql functions to 'C' functions

2005-02-03 Thread Peter Manchev
I believe the functionality I need (hiding the function code from users) will be provided with the implementation of the the following item from the Postgresql todo list: SERVER-SIDE LANGUAGES -- Add Oracle-style packages May be another future functionality will also help out, especially if the

Re: [SQL] Determining Rank

2005-02-03 Thread Michael Glaesemann
On Feb 4, 2005, at 12:06, Don Drake wrote: I have a query that shows the top N count(*)'s. So it's basically: select some_val, count(*) from big_table group by some_val order by count(*) limit 50 Now, I would like to have the rank included in the result set. The first row would be 1, followed by 2

Re: [SQL] Determining Rank

2005-02-03 Thread Michael Fuhr
On Thu, Feb 03, 2005 at 09:06:36PM -0600, Don Drake wrote: > select some_val, count(*) > from big_table > group by some_val > order by count(*) > limit 50 > > Now, I would like to have the rank included in the result set. The > first row would be 1, followed by 2, etc. all the way to 50. Maybe

[SQL] Determining Rank

2005-02-03 Thread Don Drake
I have a query that shows the top N count(*)'s. So it's basically: select some_val, count(*) from big_table group by some_val order by count(*) limit 50 Now, I would like to have the rank included in the result set. The first row would be 1, followed by 2, etc. all the way to 50. I can do thi

Re: [SQL] getting back autonumber just inserted

2005-02-03 Thread Edmund Bacon
Perhaps you meant: http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-SCHEMA-TABLE in particular |pg_get_serial_sequence|(table_name, column_name) Sean Davis wrote: On Feb 3, 2005, at 5:16 PM, lorid wrote: I could have sworn I kept a copy of prior emails that discus

Re: [SQL] getting back autonumber just inserted

2005-02-03 Thread Sean Davis
On Feb 3, 2005, at 5:16 PM, lorid wrote: I could have sworn I kept a copy of prior emails that discussed how to get back a value that was just inserted into a autonumber (or in postgresql case a sequence number) See here: http://www.postgresql.org/docs/8.0/interactive/functions- sequence.html

Re: [SQL] getting back autonumber just inserted

2005-02-03 Thread Scott Marlowe
On Thu, 2005-02-03 at 16:16, lorid wrote: > I could have sworn I kept a copy of prior emails that discussed how to > get back a value that was just inserted into a autonumber (or in > postgresql case a sequence number) If you know the name of the sequence the number came from you can use currva

[SQL] getting back autonumber just inserted

2005-02-03 Thread lorid
I could have sworn I kept a copy of prior emails that discussed how to get back a value that was just inserted into a autonumber (or in postgresql case a sequence number) any help will be appreciated thanks Lori ---(end of broadcast)--- TIP 5: Hav

[SQL] pg_restore problem -- MORE?!?

2005-02-03 Thread Bradley Miller
This is getting ridiculous . . . I dump from the database into another one (just for grins) on the same server to a different name and I don't even get all the info? My functions are coming through fine (finally) but now I've got missing tables and missing data. Could someone point me somewhere

Re: [SQL] Information about the command SQL " create synonym".

2005-02-03 Thread Karsten Hilbert
> Much like yourself, I have been searching for a way to create synonyms > in Postgres. I think that I have found a hack / solution to our > problem. ... > What I did, was to make use of the Postgres inheritance feature. > This in turn effectively creates an alias: > CREATE TABLE foo (bar int n

Re: [SQL] Calendar Function

2005-02-03 Thread Jeff Boes
Muhyiddin A.M Hayat wrote: Ok, thanks But if i would like to display date in one Month, e.g : date in feb 2005 You can do that in Pg date arithmetic: # select '1 oct 2004'::date + '1 month'::interval - '1 day'::interval; ?column? - 2004-10-31 00:00:00 (1 row) # selec

Re: [SQL] problem with backup and restore (probaly stupit newb thing)

2005-02-03 Thread Joel Fradkin
I am not running version 8 (I did try this on the linux box as well, but the version I documented was the server is linux and the client is XP). I ran it from PG admin in both cases, maybe I need to just run from the command line on the linux box (this is fine as long as I can backup the file and

Re: [SQL] Information about the command SQL " create synonym".

2005-02-03 Thread Philip Patterson
On Tue, 12 Oct 2004 15:04:14 +0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello ! > > I am trying to find some informations about the SQL command "create > synonym". > > The command "create synonym" does not exit in the Postgres database. > > I had tested with the latest version (postgr

Re: [SQL] pg_restore problem

2005-02-03 Thread Bradley Miller
Interestingly, I made a new database on my test server and then was able to do a pg_dump from my mac box to the test server and I think it got just about everything . . . I've got some constraint issues and other oddities happening, but at least my functions came in fine. I used the pipe command t

Re: [SQL] plpgsql functions to 'C' functions

2005-02-03 Thread Michael Fuhr
On Thu, Feb 03, 2005 at 05:31:47AM -0800, Peter Manchev wrote: > I believe the functionality I need (hiding the function code from users) Why do you want to hide the function code? Does it contain sensitive data? As I asked before, what problem are you trying to solve? -- Michael Fuhr http:/

Re: [SQL] problem with backup and restore (probaly stupit newb thing)

2005-02-03 Thread Tom Lane
Richard Huxton writes: > Joel Fradkin wrote: >> ServerVersion: 07.03.0200 PostgreSQL 7.4.6 on i386-redhat-linux-gnu, >> compiled by GCC i386-redhat-linux-gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2 > OK - let's start here. The syntax here is fine, I just tested it on an > 8.0 database. Are you sure

Re: [SQL] PL/PgSQL - returning multiple columns ...

2005-02-03 Thread PFC
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier <[EMAIL PROTECTED]> wrote: Perfect, worked like a charm ... but the RETURNS still needs to be a SETOF, other then that, I'm 'away to the races' ... thanks :) No SETOF necessary : CREATE TYPE mytype AS ( number INTEGER, blah TEXT );

Re: [SQL] problem with backup and restore (probaly stupit newb thing)

2005-02-03 Thread Richard Huxton
Joel Fradkin wrote: Can anyone help me out on this (I will need to backup and restore the data base, but am not savy on the proper save and restore syntax). I used the default ones in PGadmin as detailed below and it blew up on pg_restore: restoring data for table "tblaction" pg_restore: ERROR: i

Re: [SQL] PL/PgSQL - returning multiple columns ...

2005-02-03 Thread Marc G. Fournier
Perfect, worked like a charm ... but the RETURNS still needs to be a SETOF, other then that, I'm 'away to the races' ... thanks :) On Wed, 2 Feb 2005, George Weaver wrote: Hi Marc, One option is to create a simple data type and return the rowtype of the datatype eg CREATE TYPE tserverload AS ("

Re: [SQL] pg primary key bug?

2005-02-03 Thread Richard_D_Levine
There are not enough spaces available in the column to allow for the number of DOC_IDs. There are three spaces, allowing for at most four occurrences of DOC_ID, but there are eleven. --Rick

[SQL] problem with backup and restore (probaly stupit newb thing)

2005-02-03 Thread Joel Fradkin
Can anyone help me out on this (I will need to backup and restore the data base, but am not savy on the proper save and restore syntax). I used the default ones in PGadmin as detailed below and it blew up on pg_restore: restoring data for table "tblaction" pg_restore: ERROR:  invalid byte sequence

Re: [SQL] pg_restore problem

2005-02-03 Thread Richard Huxton
Bradley Miller wrote: So in the current version I'm running (7.4.6) and I do a pg_dump I have to then manually manipulate the order by doing a -l to get a table of contents and then reorder (just changing the first number; or the oid also??) just to get it to work right? Does anyone else have

Re: [SQL] [PERFORM] Tunning postgresql on linux (fedora core 3)

2005-02-03 Thread Richard Huxton
Din Adrian wrote: sorry about cc ... this is the site: http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html but I gues is not right ... hmm It's not that it's incorrect, just that you should always use the manuals as a starting point. On Thu, 03 Feb 2005 14:52:04 +, Richar

Re: [SQL] [PERFORM] Tunning postgresql on linux (fedora core 3)

2005-02-03 Thread Din Adrian
sorry about cc ... this is the site: http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html but I gues is not right ... hmm Adrian Din On Thu, 03 Feb 2005 14:52:04 +, Richard Huxton wrote: I'll repeat myself: Please CC the mailing list as well as replying to me, so that o

Re: [SQL] pg primary key bug?

2005-02-03 Thread pginfo
Hi, It is not spaces problem. I needet to dump the data and I deleted all rows for 'DOCID' with delete from a_constants_str where constname= 'DOCID'; and the pg reported 10 rows deleted. Sorry I can not execute the commend now ( I dropped the data, becaus I needet the uniqu constnames for the

Re: [SQL] pg_restore problem

2005-02-03 Thread Bradley Miller
So in the current version I'm running (7.4.6) and I do a pg_dump I have to then manually manipulate the order by doing a -l to get a table of contents and then reorder (just changing the first number; or the oid also??) just to get it to work right? Does anyone else have these issues? How exactl

Re: [SQL] pg primary key bug?

2005-02-03 Thread Michael Glaesemann
On Feb 3, 2005, at 21:53, pginfo wrote: I am using pg 7.4.5 on RedHat AS 3.0. sklad21=# \d a_constants_str Table "public.a_constants_str" Column | Type | Modifiers +---+--- constname | character varying(30) | not null fid

[SQL] pg primary key bug?

2005-02-03 Thread pginfo
Hi , I am using pg 7.4.5 on RedHat AS 3.0. I am using it via jdbc and jboss. I have found big problem about the way pg supports primary keys. The bug was reported from my customers ( we are installed pg with our ERP on ~ 500 costomers) and I do not know hot it is happen. sklad21=# \d a_constants_

Re: [SQL] problem while converting sybase quries to postgres

2005-02-03 Thread Richard Huxton
Please cc: the list when you reply to me - that way others can help too. imam wrote: If this is a left outer join, you could do something like: SELECT ... FROM pe_pop_sr_posted_tran_head t1 LEFT JOIN pe_pop_po_header t2 ON t1.po_header_pk = t2.po_header_pk LEFT JOIN pe_pop_sr_posted_tran_det t

Re: [SQL] problem while converting sybase quries to postgres

2005-02-03 Thread Richard Huxton
imam wrote: The following is a sybase query and i am trying to convet it into postgres but in postgres the join will be specified in from clause and we cannot specify any logical operator i would be grateful if you could tell me the solution for it You don't actually say what your query is trying t