From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | fernando villarroel <bbddlinux(at)yahoo(dot)es> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Scrpt batch |
Date: | 2005-03-11 14:47:31 |
Message-ID: | 20050311144731.GE3823@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
On Fri, Mar 11, 2005 at 03:30:24PM +0100, fernando villarroel wrote:
> y el script seria algo asi:
>
> #!/bin/sh
> grant select on clientes to $1
>
> grant select,insert,update,delete on ventas to $1
#!/bin/sh
if [ -z "$datos_de_conexion" ]; then
echo "ugh" >&2
exit 1
fi
if [ -z "$1" ]; then
echo "gack" >&1
exit 1
fi
psql $datos_de_conexion <<EOF
grant select on clientes to $1
grant select,insert,update,delete on ventas to $1
EOF
Esto lo puedes ejecutar desde el shell, pasandole como parametro el
nombre de usuario.
Otra alternativa seria usar las variables de psql, :VAR -- revisa la
documentacion.
--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
Y dijo Dios: "Que sea Satanás, para que la gente no me culpe de todo a mí."
"Y que hayan abogados, para que la gente no culpe de todo a Satanás"
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2005-03-11 14:51:11 | Re: cambiar tipo dato |
Previous Message | Edwin Quijada | 2005-03-11 14:46:05 | RE: cambiar tipo dato |