pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
cast
5+ messages / 5 participants
[nested] [flat]

* cast
@ 2001-10-22 22:35 Esteban Gutierrez Abarzua <esgutier@sauce.chillan.ubiobio.cl>
  2001-10-23 02:17 ` Re: cast Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Esteban Gutierrez Abarzua @ 2001-10-22 22:35 UTC (permalink / raw)
  To: pgsql-sql


hi.

I wanna to make a query on this table(postgres system catalog):

 Attribute   |   Type    | Modifier 
--------------+-----------+----------
 relname      | name      | 
 reltype      | oid       | 
 relowner     | integer   | 
 relam        | oid       | 
 relpages     | integer   | 
 reltuples    | integer   | 
 .....
 .....
 ... 
.
  select relname from pg_class;

  How can I get a char or varchar cast for the name data type?....
  because relname is a name data type and I want to get a char or varchar
data type.  


  bye .


 my english is no so good!




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cast
  2001-10-22 22:35 cast Esteban Gutierrez Abarzua <esgutier@sauce.chillan.ubiobio.cl>
@ 2001-10-23 02:17 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Stephan Szabo @ 2001-10-23 02:17 UTC (permalink / raw)
  To: Esteban Gutierrez Abarzua <esgutier@sauce.chillan.ubiobio.cl>; +Cc: pgsql-sql


On Mon, 22 Oct 2001, Esteban Gutierrez Abarzua wrote:

> 
> hi.
> 
> I wanna to make a query on this table(postgres system catalog):
> 
>  Attribute   |   Type    | Modifier 
> --------------+-----------+----------
>  relname      | name      | 
>  reltype      | oid       | 
>  relowner     | integer   | 
>  relam        | oid       | 
>  relpages     | integer   | 
>  reltuples    | integer   | 
>  .....
>  .....
>  ... 
> .
>   select relname from pg_class;
> 
>   How can I get a char or varchar cast for the name data type?....
>   because relname is a name data type and I want to get a char or varchar
> data type.  

In general, I think name and varchar(<identifier length>) are pretty
equivalent, but...

select CAST(relname as varchar) AS relname from pg_class;
should work.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* cast
@ 2005-10-14 18:08 Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>
  2005-10-14 18:19 ` Re: cast Andrew Sullivan <ajs@crankycanuck.ca>
  2005-10-14 18:20 ` Re: cast Dan Feiveson <danf@datajoe.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Judith Altamirano Figueroa @ 2005-10-14 18:08 UTC (permalink / raw)
  To: pgsql-sql

Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query
is the next:



select 	 n.factura,
		 n.venta_neta,
		 c.nombre_cli || ' ' || c.apellido_pat_cli || ' ' || coalesce
(c.apellido_mat_cli,''),	
		 date(n.fecha_hora_factura),
		 o.nombre_oft
	from 	 nota_venta n,
		 clientes c,
                 oft_central o
	where 	 date(n.fecha_hora_factura) >= '2005-10-01' and
		 date(n.fecha_hora_factura) <= '2005-10-14' and
		 n.id_cliente = c.id_cliente and
		 cast(n.udf4 as integer) = o.id_oft_central and
		 n.factura is not null and
                 n.s_factura != 'T'
	order by o.nombre_oft";

it aparently returns an error because the cast, but I need to do the
cast, does somebody knows how can I change the cast but with the same
result, thnks!!!!





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cast
  2005-10-14 18:08 cast Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>
@ 2005-10-14 18:19 ` Andrew Sullivan <ajs@crankycanuck.ca>
  1 sibling, 0 replies; 5+ messages in thread

From: Andrew Sullivan @ 2005-10-14 18:19 UTC (permalink / raw)
  To: pgsql-sql

On Fri, Oct 14, 2005 at 01:08:43PM -0500, Judith Altamirano Figueroa wrote:
> Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query
> is the next:

It'd help if we could see the table schema and the error message.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
When my information changes, I alter my conclusions.  What do you do sir?
		--attr. John Maynard Keynes



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cast
  2005-10-14 18:08 cast Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>
@ 2005-10-14 18:20 ` Dan Feiveson <danf@datajoe.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Dan Feiveson @ 2005-10-14 18:20 UTC (permalink / raw)
  To: Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>; pgsql-sql

I believe int8(n.udf4) will do the trick for you.


----- Original Message ----- 
From: "Judith Altamirano Figueroa" <jaltamirano@correolux.com.mx>
To: <pgsql-sql@postgresql.org>
Sent: Friday, October 14, 2005 12:08 PM
Subject: [SQL] cast


> Hello I have a query that ran in 7.0.2, but in 8.0.1 does not, the query
> is the next:
> 
> 
> 
> select n.factura,
> n.venta_neta,
> c.nombre_cli || ' ' || c.apellido_pat_cli || ' ' || coalesce
> (c.apellido_mat_cli,''), 
> date(n.fecha_hora_factura),
> o.nombre_oft
> from nota_venta n,
> clientes c,
>                  oft_central o
> where date(n.fecha_hora_factura) >= '2005-10-01' and
> date(n.fecha_hora_factura) <= '2005-10-14' and
> n.id_cliente = c.id_cliente and
> cast(n.udf4 as integer) = o.id_oft_central and
> n.factura is not null and
>                  n.s_factura != 'T'
> order by o.nombre_oft";
> 
> it aparently returns an error because the cast, but I need to do the
> cast, does somebody knows how can I change the cast but with the same
> result, thnks!!!!
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-10-14 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-22 22:35 cast Esteban Gutierrez Abarzua <esgutier@sauce.chillan.ubiobio.cl>
2001-10-23 02:17 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2005-10-14 18:08 cast Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>
2005-10-14 18:19 ` Andrew Sullivan <ajs@crankycanuck.ca>
2005-10-14 18:20 ` Dan Feiveson <danf@datajoe.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