pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feednewbie question
18+ messages / 14 participants
[nested] [flat]
* newbie question
@ 2001-07-11 00:26 Xue-Feng Yang <just4look@yahoo.com>
2001-07-11 01:05 ` Re: newbie question Grant <grant@conprojan.com.au>
2001-07-11 01:50 ` Re: newbie question Henry House <hajhouse@houseag.com>
0 siblings, 2 replies; 18+ messages in thread
From: Xue-Feng Yang @ 2001-07-11 00:26 UTC (permalink / raw)
To: pgsql-admin
Can anyone help me on the following problem?
$psql -h localhost
psql: PQconnectPoll() -- connect() failed: Connection
refused
Is the postmaster running (with -i) at
'localhost'
and accepting connections on TCP/IP port '5432'?
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
2001-07-11 00:26 newbie question Xue-Feng Yang <just4look@yahoo.com>
@ 2001-07-11 01:05 ` Grant <grant@conprojan.com.au>
1 sibling, 0 replies; 18+ messages in thread
From: Grant @ 2001-07-11 01:05 UTC (permalink / raw)
To: Xue-Feng Yang <just4look@yahoo.com>; +Cc: pgsql-admin
Well is postmaster running with i?
ps auwx | grep post
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
2001-07-11 00:26 newbie question Xue-Feng Yang <just4look@yahoo.com>
@ 2001-07-11 01:50 ` Henry House <hajhouse@houseag.com>
1 sibling, 0 replies; 18+ messages in thread
From: Henry House @ 2001-07-11 01:50 UTC (permalink / raw)
To: Xue-Feng Yang <just4look@yahoo.com>; +Cc: pgsql-admin
On Tue, Jul 10, 2001 at 08:26:56PM -0400, Xue-Feng Yang wrote:
> Can anyone help me on the following problem?
>
> $psql -h localhost
>
> psql: PQconnectPoll() -- connect() failed: Connection
> refused
> Is the postmaster running (with -i) at
> 'localhost'
> and accepting connections on TCP/IP port '5432'?
1. Is the postmaster process running? Check using 'ps'.
2. Is the postmaster not listening on TCP? Check using 'netstat -lnp'.
Example of what you should see:
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 31693/postmaster
unix 0 [ ACC ] STREAM LISTENING 68763 31693/postmaster /var/run/postgresql/.s.PGSQL.5432
--
Henry House
OpenPGP key available from http://romana.hajhouse.org/hajhouse.asc
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
@ 2001-07-11 03:24 Xue-Feng Yang <just4look@yahoo.com>
2001-07-11 11:09 ` RE: newbie question Nick Fankhauser <nickf@ontko.com>
2001-07-21 10:13 ` Re: newbie question Adam <adam@hotmail.com>
0 siblings, 2 replies; 18+ messages in thread
From: Xue-Feng Yang @ 2001-07-11 03:24 UTC (permalink / raw)
To: Henry House <hajhouse@houseag.com>; +Cc: pgsql-admin
--- Henry House <hajhouse@houseag.com> wrote:
> On Tue, Jul 10, 2001 at 10:02:03PM -0400, Xue-Feng
> Yang wrote:
> > Sounds that the postmaster does not listen on TCP.
> > How can I add it to TCP?
>
> You need to pass the -i switch to the postmaster
> when starting it. Most
> likely your distribution provided an initscript
> (/etc/init.d/postgresql
> perhaps) to start and stop the postmaster; if so you
> will need to edit this
> file.
>
> --
> Henry House
> OpenPGP key available from
> http://romana.hajhouse.org/hajhouse.asc
>
> ATTACHMENT part 2 application/pgp-signature
Here is the file. Please give me more suggestions.
#! /bin/sh
# postgresql This is the init script for starting
up the PostgreSQL
# server
# Version 6.5.3-2 Lamar Owen
# Added code to determine if PGDATA exists, whether it
is current version
# or not, and initdb if no PGDATA (initdb will not
overwrite a database).
# Version 7.0 Lamar Owen
# Added logging code
# Changed PGDATA.
#
# Version 7.0.2 Trond Eivind Glomsr°d <teg@redhat.com>
# use functions, add conditional restart
# chkconfig: 345 85 15
# description: Starts and stops the PostgreSQL backend
daemon that handles \
# all database requests.
# processname: postmaster
# pidfile: /var/run/postmaster.pid
#
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
# Pretty much need it for postmaster.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/bin/postmaster ] || exit 0
start(){
PSQL_CHECK="Checking postgresql installation:
"
PSQL_START="Starting postgresql service: "
echo -n "$PSQL_CHECK"
# Check for older PGDATA location.
if [ -f /var/lib/pgsql/PG_VERSION ] && [ -d
/var/lib/pgsql/base/template
1 ]
then
export PGDATA=/var/lib/pgsql
else
export PGDATA=/var/lib/pgsql/data
fi
# Check for the PGDATA structure
if [ -f $PGDATA/PG_VERSION ] && [ -d
$PGDATA/base/template1 ]
then
# Check version of existing PGDATA
if [ `cat $PGDATA/PG_VERSION` != '7.0'
]
then
echo
echo "old version. Need to
Upgrade."
echo "See
/usr/share/doc/postgresql-7.0.2/README.rpm for
more information."
exit 1
else
success "$PSQL_CHECK"
echo
fi
# No existing PGDATA! Initdb it.
else
echo "no database files found."
if [ ! -d $PGDATA ]
then
mkdir -p $PGDATA
chown postgres.postgres
$PGDATA
fi
su -l postgres -c '/usr/bin/initdb
--pglib=/usr/lib/pgsql --pgda
ta=/var/lib/pgsql/data' < /dev/null
fi
# Check for postmaster already running...
pid=`pidof postmaster`
if [ $pid ]
then
echo "Postmaster already running."
else
#all systems go -- remove any stale
lock files
rm -f /tmp/.s.PGSQL.* > /dev/null
echo -n "$PSQL_START"
su -l postgres -c "/usr/bin/pg_ctl -D
$PGDATA -p /usr/bin/postm
aster start >/dev/null 2>&1" < /dev/null
sleep 1
pid=`pidof postmaster`
if [ $pid ]
then
success "$PSQL_START"
touch
/var/lock/subsys/postgresql
echo $pid >
/var/run/postmaster.pid
echo
else
failure "$PSQL_START"
echo
fi
fi
}
stop(){
echo -n "Stopping postgresql service: "
killproc postmaster
sleep 2
rm -f /var/run/postmaster.pid
rm -f /var/lock/subsys/postgresql
echo
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/postgresql ] && restart || :
}
# This script is slightly unusual in that the name of
the daemon (postmaster)
# is not the same as the name of the subsystem
(postgresql)
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status postmaster
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo "Usage: postgresql
{start|stop|status|restart|condrestart}"
exit 1
esac
exit 0
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
^ permalink raw reply [nested|flat] 18+ messages in thread
* RE: newbie question
2001-07-11 03:24 Re: newbie question Xue-Feng Yang <just4look@yahoo.com>
@ 2001-07-11 11:09 ` Nick Fankhauser <nickf@ontko.com>
1 sibling, 0 replies; 18+ messages in thread
From: Nick Fankhauser @ 2001-07-11 11:09 UTC (permalink / raw)
To: Xue-Feng Yang <just4look@yahoo.com>; +Cc: pgsql-admin
> Here is the file. Please give me more suggestions.
Actually, I think the best place to set this would be in the config file.
The right place depends on which version you are running.
If your version is lower than 7.1, put a line in postmaster.init that looks
like this:
PGALLOWTCPIP=yes
If your version is 7.1 or higher, put a line in postgresql.conf that looks
like this:
TCPIP_SOCKET = 1
On Debian Linux these files would be found in /etc/postgresql
I'm not sure where they live on other platforms.
-Nick
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
2001-07-11 03:24 Re: newbie question Xue-Feng Yang <just4look@yahoo.com>
@ 2001-07-21 10:13 ` Adam <adam@hotmail.com>
1 sibling, 0 replies; 18+ messages in thread
From: Adam @ 2001-07-21 10:13 UTC (permalink / raw)
To: pgsql-admin
Yea it worked for me, as well.
Xue-Feng Yang <just4look@yahoo.com> wrote in article
<20010711032426.26933.qmail@web14601.mail.yahoo.com>...
| --- Henry House <hajhouse@houseag.com> wrote:
...cut
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
@ 2001-07-12 03:08 ` Xue-Feng Yang <just4look@yahoo.com>
2001-07-12 05:37 ` Re: newbie question Henry House <hajhouse@houseag.com>
1 sibling, 1 reply; 18+ messages in thread
From: Xue-Feng Yang @ 2001-07-12 03:08 UTC (permalink / raw)
To: Henry House <hajhouse@houseag.com>; +Cc: pgsql-admin
Thanks all.
The problem is changed to
[xyang@d141-67-217 xyang]$ psql -h localhost
psql: Missing or erroneous pg_hba.conf file, see
postmaster log for details
Where are thses files?
--- Henry House <hajhouse@houseag.com> wrote:
> On Tue, Jul 10, 2001 at 11:24:26PM -0400, Xue-Feng
> Yang wrote:
> [...]
> > Here is the file. Please give me more suggestions.
>
> Scroll down for the comments.
>
> > #! /bin/sh
> > # postgresql This is the init script for
> starting
> > up the PostgreSQL
> > # server
> >
> > # Version 6.5.3-2 Lamar Owen
> > # Added code to determine if PGDATA exists,
> whether it
> > is current version
> > # or not, and initdb if no PGDATA (initdb will
> not
> > overwrite a database).
> >
> > # Version 7.0 Lamar Owen
> > # Added logging code
> > # Changed PGDATA.
> > #
> >
> > # Version 7.0.2 Trond Eivind Glomsr?d
> <teg@redhat.com>
> > # use functions, add conditional restart
> >
> >
> > # chkconfig: 345 85 15
> > # description: Starts and stops the PostgreSQL
> backend
> > daemon that handles \
> > # all database requests.
> > # processname: postmaster
> > # pidfile: /var/run/postmaster.pid
> > #
> >
> > # Source function library.
> > . /etc/rc.d/init.d/functions
> >
> > # Get config.
> > . /etc/sysconfig/network
> >
> > # Check that networking is up.
> > # Pretty much need it for postmaster.
> > [ ${NETWORKING} = "no" ] && exit 0
> >
> > [ -f /usr/bin/postmaster ] || exit 0
> >
> >
> > start(){
> > PSQL_CHECK="Checking postgresql
> installation:
> > "
> > PSQL_START="Starting postgresql service: "
> >
> > echo -n "$PSQL_CHECK"
> >
> > # Check for older PGDATA location.
> > if [ -f /var/lib/pgsql/PG_VERSION ] && [
> -d
> > /var/lib/pgsql/base/template
> > 1 ]
> > then
> > export PGDATA=/var/lib/pgsql
> > else
> > export PGDATA=/var/lib/pgsql/data
> > fi
> >
> > # Check for the PGDATA structure
> > if [ -f $PGDATA/PG_VERSION ] && [ -d
> > $PGDATA/base/template1 ]
> > then
> > # Check version of existing PGDATA
> >
> > if [ `cat $PGDATA/PG_VERSION` !=
> '7.0'
> > ]
> > then
> > echo
> > echo "old version. Need to
> > Upgrade."
> > echo "See
> > /usr/share/doc/postgresql-7.0.2/README.rpm for
> > more information."
> > exit 1
> > else
> > success "$PSQL_CHECK"
> > echo
> > fi
> >
> > # No existing PGDATA! Initdb it.
> >
> > else
> > echo "no database files found."
> > if [ ! -d $PGDATA ]
> > then
> > mkdir -p $PGDATA
> > chown postgres.postgres
> > $PGDATA
> > fi
> > su -l postgres -c '/usr/bin/initdb
> > --pglib=/usr/lib/pgsql --pgda
> > ta=/var/lib/pgsql/data' < /dev/null
> > fi
> >
> > # Check for postmaster already running...
> > pid=`pidof postmaster`
> > if [ $pid ]
> > then
> > echo "Postmaster already running."
> > else
> > #all systems go -- remove any
> stale
> > lock files
> > rm -f /tmp/.s.PGSQL.* > /dev/null
> > echo -n "$PSQL_START"
> > su -l postgres -c "/usr/bin/pg_ctl
> -D
> > $PGDATA -p /usr/bin/postm
> > aster start >/dev/null 2>&1" < /dev/null
>
> The previous line (mangled by mailer word wrapping)
> starts the postmaster.
> Try changing it to:
>
> su -l postgres -c "/usr/bin/pg_ctl -D $PGDATA -p
> /usr/bin/postmaster start -o "-i" >/dev/null 2>&1" <
> /dev/null
>
> The -o "<options>" tells the pg_ctl utility to pass
> the options in <options>
> to the postmaster when starting it. There is a
> manual page on pg_ctl; you may
> find it useful. You can pass any options to the
> postmaster, so you could make
> it listed to any tcp port you like.
>
> > sleep 1
> > pid=`pidof postmaster`
> > if [ $pid ]
> > then
> > success "$PSQL_START"
> > touch
> > /var/lock/subsys/postgresql
> > echo $pid >
> > /var/run/postmaster.pid
> > echo
> > else
> > failure "$PSQL_START"
> > echo
> > fi
> > fi
> > }
> >
> > stop(){
> > echo -n "Stopping postgresql service: "
> > killproc postmaster
> > sleep 2
> > rm -f /var/run/postmaster.pid
> > rm -f /var/lock/subsys/postgresql
> > echo
> > }
> >
> > restart(){
> > stop
> > start
> > }
> >
> > condrestart(){
> > [ -e /var/lock/subsys/postgresql ] && restart
> || :
> > }
> >
> >
> > # This script is slightly unusual in that the name
> of
> > the daemon (postmaster)
> > # is not the same as the name of the subsystem
> > (postgresql)
> >
> > # See how we were called.
> > case "$1" in
> > start)
> > start
> > ;;
> > stop)
> > stop
> > ;;
> > status)
> > status postmaster
> > ;;
> > restart)
> > restart
> > ;;
> > condrestart)
> > condrestart
> > ;;
>
=== message truncated ===
> ATTACHMENT part 2 application/pgp-signature
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
2001-07-12 03:08 ` Re: newbie question Xue-Feng Yang <just4look@yahoo.com>
@ 2001-07-12 05:37 ` Henry House <hajhouse@houseag.com>
0 siblings, 0 replies; 18+ messages in thread
From: Henry House @ 2001-07-12 05:37 UTC (permalink / raw)
To: Xue-Feng Yang <just4look@yahoo.com>; +Cc: pgsql-admin
On Wed, Jul 11, 2001 at 11:08:00PM -0400, Xue-Feng Yang wrote:
> Thanks all.
> The problem is changed to
>
> [xyang@d141-67-217 xyang]$ psql -h localhost
> psql: Missing or erroneous pg_hba.conf file, see
> postmaster log for details
>
> Where are thses files?
I don't know --- it depends out your distribution. Try using rpm to find out.
On Debian it is /etc/postgresql/pg_hba.conf.
--
Henry House
OpenPGP key available from http://romana.hajhouse.org/hajhouse.asc
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: newbie question
@ 2001-07-12 03:08 ` Xue-Feng Yang <just4look@yahoo.com>
1 sibling, 0 replies; 18+ messages in thread
From: Xue-Feng Yang @ 2001-07-12 03:08 UTC (permalink / raw)
To: Henry House <hajhouse@houseag.com>; +Cc: pgsql-admin
Thanks all.
The problem is changed to
[xyang@d141-67-217 xyang]$ psql -h localhost
psql: Missing or erroneous pg_hba.conf file, see
postmaster log for details
Where are thses files?
--- Henry House <hajhouse@houseag.com> wrote:
> On Tue, Jul 10, 2001 at 11:24:26PM -0400, Xue-Feng
> Yang wrote:
> [...]
> > Here is the file. Please give me more suggestions.
>
> Scroll down for the comments.
>
> > #! /bin/sh
> > # postgresql This is the init script for
> starting
> > up the PostgreSQL
> > # server
> >
> > # Version 6.5.3-2 Lamar Owen
> > # Added code to determine if PGDATA exists,
> whether it
> > is current version
> > # or not, and initdb if no PGDATA (initdb will
> not
> > overwrite a database).
> >
> > # Version 7.0 Lamar Owen
> > # Added logging code
> > # Changed PGDATA.
> > #
> >
> > # Version 7.0.2 Trond Eivind Glomsr?d
> <teg@redhat.com>
> > # use functions, add conditional restart
> >
> >
> > # chkconfig: 345 85 15
> > # description: Starts and stops the PostgreSQL
> backend
> > daemon that handles \
> > # all database requests.
> > # processname: postmaster
> > # pidfile: /var/run/postmaster.pid
> > #
> >
> > # Source function library.
> > . /etc/rc.d/init.d/functions
> >
> > # Get config.
> > . /etc/sysconfig/network
> >
> > # Check that networking is up.
> > # Pretty much need it for postmaster.
> > [ ${NETWORKING} = "no" ] && exit 0
> >
> > [ -f /usr/bin/postmaster ] || exit 0
> >
> >
> > start(){
> > PSQL_CHECK="Checking postgresql
> installation:
> > "
> > PSQL_START="Starting postgresql service: "
> >
> > echo -n "$PSQL_CHECK"
> >
> > # Check for older PGDATA location.
> > if [ -f /var/lib/pgsql/PG_VERSION ] && [
> -d
> > /var/lib/pgsql/base/template
> > 1 ]
> > then
> > export PGDATA=/var/lib/pgsql
> > else
> > export PGDATA=/var/lib/pgsql/data
> > fi
> >
> > # Check for the PGDATA structure
> > if [ -f $PGDATA/PG_VERSION ] && [ -d
> > $PGDATA/base/template1 ]
> > then
> > # Check version of existing PGDATA
> >
> > if [ `cat $PGDATA/PG_VERSION` !=
> '7.0'
> > ]
> > then
> > echo
> > echo "old version. Need to
> > Upgrade."
> > echo "See
> > /usr/share/doc/postgresql-7.0.2/README.rpm for
> > more information."
> > exit 1
> > else
> > success "$PSQL_CHECK"
> > echo
> > fi
> >
> > # No existing PGDATA! Initdb it.
> >
> > else
> > echo "no database files found."
> > if [ ! -d $PGDATA ]
> > then
> > mkdir -p $PGDATA
> > chown postgres.postgres
> > $PGDATA
> > fi
> > su -l postgres -c '/usr/bin/initdb
> > --pglib=/usr/lib/pgsql --pgda
> > ta=/var/lib/pgsql/data' < /dev/null
> > fi
> >
> > # Check for postmaster already running...
> > pid=`pidof postmaster`
> > if [ $pid ]
> > then
> > echo "Postmaster already running."
> > else
> > #all systems go -- remove any
> stale
> > lock files
> > rm -f /tmp/.s.PGSQL.* > /dev/null
> > echo -n "$PSQL_START"
> > su -l postgres -c "/usr/bin/pg_ctl
> -D
> > $PGDATA -p /usr/bin/postm
> > aster start >/dev/null 2>&1" < /dev/null
>
> The previous line (mangled by mailer word wrapping)
> starts the postmaster.
> Try changing it to:
>
> su -l postgres -c "/usr/bin/pg_ctl -D $PGDATA -p
> /usr/bin/postmaster start -o "-i" >/dev/null 2>&1" <
> /dev/null
>
> The -o "<options>" tells the pg_ctl utility to pass
> the options in <options>
> to the postmaster when starting it. There is a
> manual page on pg_ctl; you may
> find it useful. You can pass any options to the
> postmaster, so you could make
> it listed to any tcp port you like.
>
> > sleep 1
> > pid=`pidof postmaster`
> > if [ $pid ]
> > then
> > success "$PSQL_START"
> > touch
> > /var/lock/subsys/postgresql
> > echo $pid >
> > /var/run/postmaster.pid
> > echo
> > else
> > failure "$PSQL_START"
> > echo
> > fi
> > fi
> > }
> >
> > stop(){
> > echo -n "Stopping postgresql service: "
> > killproc postmaster
> > sleep 2
> > rm -f /var/run/postmaster.pid
> > rm -f /var/lock/subsys/postgresql
> > echo
> > }
> >
> > restart(){
> > stop
> > start
> > }
> >
> > condrestart(){
> > [ -e /var/lock/subsys/postgresql ] && restart
> || :
> > }
> >
> >
> > # This script is slightly unusual in that the name
> of
> > the daemon (postmaster)
> > # is not the same as the name of the subsystem
> > (postgresql)
> >
> > # See how we were called.
> > case "$1" in
> > start)
> > start
> > ;;
> > stop)
> > stop
> > ;;
> > status)
> > status postmaster
> > ;;
> > restart)
> > restart
> > ;;
> > condrestart)
> > condrestart
> > ;;
>
=== message truncated ===
> ATTACHMENT part 2 application/pgp-signature
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
^ permalink raw reply [nested|flat] 18+ messages in thread
* Newbie question
@ 2003-01-14 14:12 David <david@cnb.uam.es>
2003-01-14 14:50 ` Re: Newbie question Robert Treat <xzilla@users.sourceforge.net>
0 siblings, 1 reply; 18+ messages in thread
From: David @ 2003-01-14 14:12 UTC (permalink / raw)
To: pgsql-admin
How to grant a whole database for a certain user ?
i mean:
<mysql>
grant usage on mydb.* to myuser identified by 'mypasswd'
</mysql>
Is available something similar with postgres or should i write a
shell script, for example?
Thank you very much!!!
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Newbie question
2003-01-14 14:12 Newbie question David <david@cnb.uam.es>
@ 2003-01-14 14:50 ` Robert Treat <xzilla@users.sourceforge.net>
0 siblings, 0 replies; 18+ messages in thread
From: Robert Treat @ 2003-01-14 14:50 UTC (permalink / raw)
To: David <david@cnb.uam.es>; +Cc: pgsql-admin
On Tue, 2003-01-14 at 09:12, David wrote:
> How to grant a whole database for a certain user ?
> i mean:
> <mysql>
> grant usage on mydb.* to myuser identified by 'mypasswd'
> </mysql>
> Is available something similar with postgres or should i write a shell
> script, for example?
> Thank you very much!!!
You'll need to right a shell script or a server side function to do
this.
BTW - some people have talked about adding this feature in the past, and
I think that if the code were submitted it wouldn't be rejected, but
AFAIK the SQL standard doesn't support setting the privileges on more
than one table per command so it is low priority for the main
development team.
Robert Treat
^ permalink raw reply [nested|flat] 18+ messages in thread
* Newbie question
@ 2003-06-26 19:59 Vinay <vinay@mdp.net>
2003-06-26 20:29 ` Re: Newbie question scott.marlowe <scott.marlowe@ihs.com>
2003-06-26 20:39 ` Re: Newbie question Bruno Wolff III <bruno@wolff.to>
0 siblings, 2 replies; 18+ messages in thread
From: Vinay @ 2003-06-26 19:59 UTC (permalink / raw)
To: pgsql-admin
I have a very simple question regarding creating columns in a table
Can we create a column in a table in such a way that it will allow only certain length, nothing less or nothing more
here is an example
create table test(column1 char(2));
will create table with column1 which will accept characters upto length two.
I want the column to accept the column value which is absolutely length of two.
Any Help appreciated
Thank you
Vinay
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Newbie question
2003-06-26 19:59 Newbie question Vinay <vinay@mdp.net>
@ 2003-06-26 20:29 ` scott.marlowe <scott.marlowe@ihs.com>
1 sibling, 0 replies; 18+ messages in thread
From: scott.marlowe @ 2003-06-26 20:29 UTC (permalink / raw)
To: Vinay <vinay@mdp.net>; +Cc: pgsql-admin
On Thu, 26 Jun 2003, Vinay wrote:
> I have a very simple question regarding creating columns in a table
>
> Can we create a column in a table in such a way that it will allow only certain length, nothing less or nothing more
>
> here is an example
>
>
> create table test(column1 char(2));
>
> will create table with column1 which will accept characters upto length two.
> I want the column to accept the column value which is absolutely length of two.
create table p (name text check (length(name)=2));
I'm not sure I can make it work for char(), it seems, since char is always
autopadded out to two characters before it gets to the check constraint.
It will work with text and varchar(2) types.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Newbie question
2003-06-26 19:59 Newbie question Vinay <vinay@mdp.net>
@ 2003-06-26 20:39 ` Bruno Wolff III <bruno@wolff.to>
2003-06-27 02:47 ` Re: Newbie question Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 18+ messages in thread
From: Bruno Wolff III @ 2003-06-26 20:39 UTC (permalink / raw)
To: Vinay <vinay@mdp.net>; +Cc: pgsql-admin
On Thu, Jun 26, 2003 at 15:59:55 -0400,
Vinay <vinay@mdp.net> wrote:
> I have a very simple question regarding creating columns in a table
>
> Can we create a column in a table in such a way that it will allow only certain length, nothing less or nothing more
>
> here is an example
>
>
> create table test(column1 char(2));
>
> will create table with column1 which will accept characters upto length two.
> I want the column to accept the column value which is absolutely length of two.
A char(2) will always have two characters (unless it is NULL). If you want
to check for two nonblank characters or two letters or something like
that use a check constraint.
Some like:
create table test (
col1 char(2) constraint bad_length check (col1 ~ '^[a-zA-Z][a-zA-Z]$'
);
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Newbie question
2003-06-26 19:59 Newbie question Vinay <vinay@mdp.net>
2003-06-26 20:39 ` Re: Newbie question Bruno Wolff III <bruno@wolff.to>
@ 2003-06-27 02:47 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 18+ messages in thread
From: Tom Lane @ 2003-06-27 02:47 UTC (permalink / raw)
To: Bruno Wolff III <bruno@wolff.to>; +Cc: Vinay <vinay@mdp.net>; pgsql-admin
Bruno Wolff III <bruno@wolff.to> writes:
>> I want the column to accept the column value which is absolutely length of two.
> A char(2) will always have two characters (unless it is NULL). If you want
> to check for two nonblank characters or two letters or something like
> that use a check constraint.
> Some like:
> create table test (
> col1 char(2) constraint bad_length check (col1 ~ '^[a-zA-Z][a-zA-Z]$'
> );
The most obvious way to my mind is
check(length(rtrim(col1)) = 2)
if "length" is simply defined as "number of characters excluding
trailing blanks". If you want a more complex check then something
like Bruno's example will probably get the job done.
If you are going to apply a constraint like this then I'd counsel just
declaring the column as text --- making it char(2) simply means that
the system is applying an extra check that is redundant with your
constraint.
regards, tom lane
^ permalink raw reply [nested|flat] 18+ messages in thread
* newbie question
@ 2010-09-04 18:46 Jeroen Baten <jeroen@molenwindsingel.nl>
0 siblings, 0 replies; 18+ messages in thread
From: Jeroen Baten @ 2010-09-04 18:46 UTC (permalink / raw)
To: pgsql-admin
Hello,
I saw a demo last week of oracle enterprise manager where the dba can
see a graphical view of the server load, click and zoom on peak levels
and zoom in on queries that took a long time.
Now I am the open source advocate within our organisation and have had
some succes.
Are there tools that present these kind of info for PostgreSQL?
please reply to my email adres since I am not a subscriber tot this list.
kind regards,
--
, ,
/ '. .' \ Jeroen Baten
/ '. .' \ Molenwindsingel 46
'-._ '. .' _.-' 4105 HK Culemborg
'-. ; .-' jeroen@molenwindsingel.nl
_.-;(_);-._ www.molenwindsingel.nl
_.-' .'_'. '-._
\ .'/[+]\'. /
\_.' / \ '._/
| _ |
| [_] |
/III III\
`"""""""`
^ permalink raw reply [nested|flat] 18+ messages in thread
* Newbie question
@ 2018-03-20 16:50 Ron Watkins <rwatki@gmail.com>
2018-03-20 16:57 ` Re: Newbie question Andrew Foster <afoster@educationalmeasures.com>
0 siblings, 1 reply; 18+ messages in thread
From: Ron Watkins @ 2018-03-20 16:50 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
I am pretty new to Postgresql.
I have a database with a schema, ill call it 'FOO' here in the message.
I also have a developer, who want's to create a function for use in the
'FOO' schema.
Im not finding the appropriate command to allow that user to create a
function in the FOO schema (or elsewhere).
Is there such a command? I was looking under the 'GRANT' but I don't see a
way to grant "CREATE or REPLACE FUNCTION".
Am I missing anything here? What is the best approach?
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Newbie question
2018-03-20 16:50 Newbie question Ron Watkins <rwatki@gmail.com>
@ 2018-03-20 16:57 ` Andrew Foster <afoster@educationalmeasures.com>
0 siblings, 0 replies; 18+ messages in thread
From: Andrew Foster @ 2018-03-20 16:57 UTC (permalink / raw)
To: Ron Watkins <rwatki@gmail.com>; pgsql-admin@lists.postgresql.org
Hi Ron,
If you GRANT CREATE and USAGE on schema FOO for the developer's user,
your developer should be able to create new objects (in this case,
functions) in schema FOO.
My suggestion for a best approach would be to consider what your default
privileges should be
(https://www.postgresql.org/docs/current/static/sql-alterdefaultprivileges.html)
as well as setting up groups so that you don't have to modify
permissions for each individual.
Hope this helps!
Andrew Foster | Educational Measures, LLC
Sr. Database Administrator
On 3/20/18 10:50 AM, Ron Watkins wrote:
>
> I am pretty new to Postgresql.
>
> I have a database with a schema, ill call it ‘FOO’ here in the message.
>
> I also have a developer, who want’s to create a function for use in
> the ‘FOO’ schema.
>
> Im not finding the appropriate command to allow that user to create a
> function in the FOO schema (or elsewhere).
>
> Is there such a command? I was looking under the ‘GRANT’ but I don’t
> see a way to grant “CREATE or REPLACE FUNCTION”.
>
> Am I missing anything here? What is the best approach?
>
^ permalink raw reply [nested|flat] 18+ messages in thread
end of thread, other threads:[~2018-03-20 16:57 UTC | newest]
Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-11 00:26 newbie question Xue-Feng Yang <just4look@yahoo.com>
2001-07-11 01:05 ` Grant <grant@conprojan.com.au>
2001-07-11 01:50 ` Henry House <hajhouse@houseag.com>
2001-07-11 03:24 Re: newbie question Xue-Feng Yang <just4look@yahoo.com>
2001-07-11 11:09 ` Nick Fankhauser <nickf@ontko.com>
2001-07-21 10:13 ` Adam <adam@hotmail.com>
2001-07-12 03:08 ` Xue-Feng Yang <just4look@yahoo.com>
2001-07-12 05:37 ` Henry House <hajhouse@houseag.com>
2001-07-12 03:08 ` Xue-Feng Yang <just4look@yahoo.com>
2003-01-14 14:12 Newbie question David <david@cnb.uam.es>
2003-01-14 14:50 ` Re: Newbie question Robert Treat <xzilla@users.sourceforge.net>
2003-06-26 19:59 Newbie question Vinay <vinay@mdp.net>
2003-06-26 20:29 ` Re: Newbie question scott.marlowe <scott.marlowe@ihs.com>
2003-06-26 20:39 ` Re: Newbie question Bruno Wolff III <bruno@wolff.to>
2003-06-27 02:47 ` Re: Newbie question Tom Lane <tgl@sss.pgh.pa.us>
2010-09-04 18:46 newbie question Jeroen Baten <jeroen@molenwindsingel.nl>
2018-03-20 16:50 Newbie question Ron Watkins <rwatki@gmail.com>
2018-03-20 16:57 ` Re: Newbie question Andrew Foster <afoster@educationalmeasures.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox