dbTalk Databases Forums  

New from mssql. Help please

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss New from mssql. Help please in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hendro
 
Posts: n/a

Default New from mssql. Help please - 05-21-2004 , 02:49 AM






Hi,
I'm new here.
My major problem is working with functions. (previously I use SQL
Server)
For instance, I haven't find a way to alter a function, or to view
function list.
(any keystroke like \d that will display functions ?)
Can anybody suggest a nice place to start? An URL perhaps?

BTW, \? returns nothing in psql. How come?

Thanks
Hendro



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #2  
Old   
Joe Erickson
 
Posts: n/a

Default Re: New from mssql. Help please - 05-21-2004 , 07:40 AM






In psql, you can do a \da to list aggregate functions, like max() and sum(), and \df to list functions. This is probably not the best way to learn the functions though. A good web site that lists functions is http://www.postgresql.org/docs/7.4/i...functions.html



-----Original Message-----
From: pgsql-novice-owner (AT) postgresql (DOT) org
[mailtogsql-novice-owner (AT) postgresql (DOT) org]On Behalf Of hendro
Sent: Friday, May 21, 2004 3:50 AM
To: pgsql-novice (AT) postgresql (DOT) org
Subject: [NOVICE] New from mssql. Help please


Hi,
I'm new here.
My major problem is working with functions. (previously I use SQL
Server)
For instance, I haven't find a way to alter a function, or to view
function list.
(any keystroke like \d that will display functions ?)
Can anybody suggest a nice place to start? An URL perhaps?

BTW, \? returns nothing in psql. How come?

Thanks
Hendro



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #3  
Old   
Rory Campbell-Lange
 
Posts: n/a

Default Re: New from mssql. Help please - 05-22-2004 , 02:27 PM



Hi Hendro

On 21/05/04, hendro (hendro (AT) connexiasolutions (DOT) com) wrote:
Quote:
I'm new here.
My major problem is working with functions. (previously I use SQL
Server)
For instance, I haven't find a way to alter a function, or to view
function list.
For general help, start with \? on the psql command line.

For a function list, do \df on the psql command line.

This also works with wildcards, so you can get a list of functions
matching a pattern, eg:

st=> \df *sum*
List of functions
Result data type | Schema | Name | Argument data types
------------------+------------+----------+---------------------
bigint | pg_catalog | int2_sum | bigint, smallint
bigint | pg_catalog | int4_sum | bigint, integer
numeric | pg_catalog | int8_sum | numeric, bigint
(3 rows)

Quote:
(any keystroke like \d that will display functions ?)
Can anybody suggest a nice place to start? An URL perhaps?
If you are writing your own functions, you can use the following syntax
to create or replace functions:

CREATE OR REPLACE FUNCTION
fn_c3_delete_contact (integer, varchar) RETURNS INTEGER
AS '
DECLARE
creator ALIAS for $1;
recone RECORD;
BEGIN

IF creator IS NULL
THEN
RAISE EXCEPTION ''no creator found at fn_c3_delete_contact'';
END IF;

RETURN 1;

END;'
LANGUAGE plpgsql;

A good way of upgrading a set of functions is to have a file with the
names of all the files in which you have functions, eg:

....
\i sql/fn_m3_explore.sql
\i sql/fn_p1_create_page.sql
\i sql/fn_p2_edit_page.sql
\i sql/fn_p3_move_page.sql
....

Now reference the file containting these references on the psql command
line (eg \i sql/fn_function_loader.sql) and all of your functions will
be updated.

Rory

--
Rory Campbell-Lange
<rory (AT) campbell-lange (DOT) net>
<www.campbell-lange.net>

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



Reply With Quote
  #4  
Old   
Andrew Hammond
 
Posts: n/a

Default Re: New from mssql. Help please - 05-25-2004 , 04:51 PM



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hendro wrote:
Quote:
I've tried it, but nothing happen, just display some text says "less:not
found" What's wrong?
psql is trying to send the output of your command to a pager. A pager is
a program which displays output in a console one page at a time. The
default pager is called "less". To solve your problem, install the
cygwin less package.

Quote:
PostgreSQL 7.3.1 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2
20020927 (prerelease)

Should I upgrade?
If it's easy, sure. However, it sounds like you're just using it to play
around and learn postgres. So it's probably not worth going to the
effort if it's going to be a lot of work for you to upgrade. 7.4 offers
CREATE OR REPLACE FUNCTION which is the way to alter a function that you
were asking about below.

Andrew Hammond
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAs7/Tgfzn5SevSpoRAr4hAJ4rnw1+CLIWjEjZlWgsVoCJvsWOUgCeP noj
fTXo32NKiPCnuR7EX25/+Nw=
=+LNp
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #5  
Old   
Gaetano Mendola
 
Posts: n/a

Default Re: New from mssql. Help please - 05-25-2004 , 08:07 PM



Andrew Hammond wrote:

Quote:
hendro wrote:
| I've tried it, but nothing happen, just display some text says "less:not
| found" What's wrong?

psql is trying to send the output of your command to a pager. A pager is
a program which displays output in a console one page at a time. The
default pager is called "less". To solve your problem, install the
cygwin less package.

| PostgreSQL 7.3.1 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2
| 20020927 (prerelease)
|
| Should I upgrade?

If it's easy, sure. However, it sounds like you're just using it to play
around and learn postgres. So it's probably not worth going to the
effort if it's going to be a lot of work for you to upgrade. 7.4 offers
CREATE OR REPLACE FUNCTION which is the way to alter a function that you
were asking about below.
Also the 7.3 series have the CREATE OR REPLACE feature ( view and function ).



Regards
Gaetano Mendola





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.