How can I view and edit a function in psql? I have been using PgAdmin to
do this but wanted to try the command line
TIA
Patrick Hatcher 7 17552
To the best of my knowledge, this is not possible in psql.
You can edit individual queries with \e, but I don't think it's
possible to edit functions.
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Nov 4, 2004, at 11:11 AM, Patrick Hatcher wrote: How can I view and edit a function in psql? *I have been using PgAdmin to do this but wanted to try the command line TIA
Patrick Hatcher
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
On Thu, Nov 04, 2004 at 02:22:06PM -0600, Thomas F.O'Connell wrote: To the best of my knowledge, this is not possible in psql.
You can edit individual queries with \e, but I don't think it's possible to edit functions.
It is of course possible get the definition using \df+ and then use
CREATE OR REPLACE in conjuntion with \e to edit it at will.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Tulio: oh, para qué servirá este boton, Juan Carlos?
Policarpo: No, aléjense, no toquen la consola!
Juan Carlos: Lo apretaré una y otra vez.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Thanks Alvaro. That was what I was looking for.
Patrick Hatcher
Alvaro Herrera <al******@dcc.u chile.cl>
11/04/04 03:40 PM
To
"Thomas F.O'Connell" <tf*@sitening.c om>
cc
Patrick Hatcher <PH******@macys .com>, pg***********@p ostgresql.org
Subject
Re: [GENERAL] how to edit a function from psql?
On Thu, Nov 04, 2004 at 02:22:06PM -0600, Thomas F.O'Connell wrote: To the best of my knowledge, this is not possible in psql. You can edit individual queries with \e, but I don't think it's possible to edit functions.
It is of course possible get the definition using \df+ and then use
CREATE OR REPLACE in conjuntion with \e to edit it at will.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Tulio: oh, para qué servirá este boton, Juan Carlos?
Policarpo: No, aléjense, no toquen la consola!
Juan Carlos: Lo apretaré una y otra vez.
Alvaro,
How do you get the results of \df+ into the buffer with \e? Just copy
and paste?
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Nov 4, 2004, at 3:40 PM, Alvaro Herrera wrote: On Thu, Nov 04, 2004 at 02:22:06PM -0600, Thomas F.O'Connell wrote: To the best of my knowledge, this is not possible in psql.
You can edit individual queries with \e, but I don't think it's possible to edit functions.
It is of course possible get the definition using \df+ and then use CREATE OR REPLACE in conjuntion with \e to edit it at will.
-- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) Tulio: oh, para qué servirá este boton, Juan Carlos? Policarpo: No, aléjense, no toquen la consola! Juan Carlos: Lo apretaré una y otra vez.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)
On Thu, Nov 04, 2004 at 04:00:10PM -0600, Thomas F. O'Connell wrote:
Thomas, How do you get the results of \df+ into the buffer with \e? Just copy and paste?
Right. Single quotes tended to be an issue. Not so with 8.0. It's
much better, of course, to have the original definition on a text file
somewhere ...
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Este mail se entrega garantizadament e 100% libre de sarcasmo.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
What would be really useful would be a command that would return the
actual SQL needed to create a function. At present the output from
\df+ needs to be pieced together to create a new CREATE OR REPLACE
string. A command that returnes that string for you would allow you to
copy and paste it in, do a minor edit and run the command very
quickly.
I've had to tweak functions quite a lot lately and having to construct
the command from the output from \df+ can be a bit of a pain.
In fact, it would be useful to have this for all entity types in the
system: tables, views and types etc. Perhaps a new symbol to follow
the \d command, such as * (just a random guess).
So:
\df* functionname
would output the CREATE OR REPLACE line for that funtion.
Thoughts?
On Thu, 4 Nov 2004 19:44:53 -0300, Alvaro Herrera
<al******@dcc.u chile.cl> wrote: On Thu, Nov 04, 2004 at 04:00:10PM -0600, Thomas F. O'Connell wrote:
Thomas,
How do you get the results of \df+ into the buffer with \e? Just copy and paste?
Right. Single quotes tended to be an issue. Not so with 8.0. It's much better, of course, to have the original definition on a text file somewhere ...
-- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) Este mail se entrega garantizadament e 100% libre de sarcasmo.
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
--
Russ
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
What version of postgres are you using? In postgresql-7.4.6, I get an
empty query buffer when I try what you describe here.
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Nov 4, 2004, at 5:23 PM, Karim Nassar wrote: Here is what I get:
orfs=# \df+ get_datasets
List of functions Result data type | Schema | Name | Argument data types | Owner | Language | Source code | Description ------------------+--------------+-------------- +-------------------------------------------------+-------+---------- +---------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- ------------------------------------+------------- refcursor | weather_data | get_datasets | refcursor, character varying, character varying | kan4 | plpgsql | DECLARE _person_ ALIAS FOR $2; _where_ ALIAS FOR $3; selectstring text;
BEGIN selectstring := get_datasets_se lstr(_person_, _where_); -- RAISE NOTICE '%', selectstring; OPEN $1 FOR EXECUTE selectstring; RETURN $1; END; | (1 row)
orfs=# \e CREATE FUNCTION
When I issue \e, the editor window pops up, apparently with the contents of the query buffer. When I exit the editor, the function definition is applied to create this function (the one in the buffer).
orfs=# \? <snip> Query Buffer \e [FILE] edit the query buffer (or file) with external editor \g [FILE] send query buffer to server (and results to file or |pipe) \p show the contents of the query buffer \r reset (clear) the query buffer \s [FILE] display history or save it to file \w [FILE] write query buffer to file <snip>
How did that function definition get in the query buffer? Seems that it sure would be nice to fill it \df+...
\<.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives? http://archives.postgresql.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel Schuchardt |
last post by:
Hi @ all,
i'm sure there was a psql-function to transfere my Blob-Data to the
server but I can't remember.
I have a script like this :
UPDATE xy SET z = lo_import('localpath_and_file');
but i want to execute this script from the client and so my blob-data is
|
by: Phil Campaigne |
last post by:
Hi All,
I just installed postgresql 7.3.4 as an upgrade to 7.3.2 and all went
well untill I tried to log into a database that I successfully created.
Here are the steps in question:
bash-2.05b$ psql -h localhost -U postgres hardwoodthunder
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
|
by: Willem Herremans |
last post by:
I am developing a client application for postgreSQL in Tcl/Tk (see
http://gborg.postgresql.org/project/pfm ).
It mainly uses PgTcl or pgintcl. I don't have any problems with those,
but I am also trying to call psql from my application for SQL statements
typed directly by the user.
I have used the Tcl command
set psqlChannel
|
by: Jim Steinberger |
last post by:
Hey all - my inaugural post,
I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to
PostgreSQL 7.3.4 running on the same server (Red Hat Linux ).
I have a Perl script that drops the database and rebuilds it with all of our
|
by: Chris Goughnour |
last post by:
I'm trying to write two C language user defined functions, lockfile() and
unlockfile(), that call flock using LOCK_EX and LOCK_UN respectively. If I
call lockfile from a first psql process it returns successfully. Calling
lockfile from a second psql process blocks. However, when I call unlockfile
from the first psql process, the second process still blocks. The lockfile
call from the second psql proccess doesn't return until I kill the...
| |
by: Dino Vliet |
last post by:
Hi folks,
probably this is a question you've heard so many times
but I wasn't able to find a solution to it.
I'm using a shell script to create a textfile for me.
It looks like
#!/usr/local/bin/bash
psql -c "select foo from bar;" -d database1 -t
psql -c "\q" -d database1
exit 0
|
by: Russ Brown |
last post by:
Hello,
Today I tried connecting to my database locally via psql. I got the usual
welcome & basic help messages, but it never got to the prompt: it just
hung. So I checked top and the psql process was increasing in size at
quite a rate (up to a gig in under 30 seconds).
I'd been using psql with no problems only a couple of hours ago, and I
haven't installed anything for at least a couple of days that I can think
of.
|
by: frederic.germaneau |
last post by:
I'm trying to stress PostgreSQL 8beta3 on AIX5.2 with TPCH 1 Go
I have created and configurated a database on 2 tablespaces : first one for
indexes and second one for tables
First script for database creation:
$ more scrCreateDataBase.sh
psql template1<<!
create tablespace dataTbl location '/postgres_data/TpchDataTableSpace';
create tablespace indexTbl location '/postgres_data/TpchIndexTableSpace';
|
by: oksofar |
last post by:
Hello -
I'm running PG 8.1 on Windows XP.
I've installed the server to run as a service.
The psql command fails to connect to the server, although I can connect with other clients.
When I enter psql -d mydb -h localhost -U admin
I get the following response:
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" and accepting
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |