Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
Postgres create view as not a view

Maintaining code from a former employee found a piece of SQL i cannot understand:

CREATE OR REPLACE VIEW my_view AS Not a view

There's no info on official documentation and I've beenseeking for information on this query but to no avail.

any hint?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The view was deleted.

Your script was generated by an application which uses pg_get_viewdef(view_oid). When there is no a view with a given oid then the function returns the string not a view. Simple test:

create view my_view as select 1;

select oid 
from pg_class 
where relname = 'my_view';

  oid   
--------
 151388
(1 row)

select pg_get_viewdef(151388);

 pg_get_viewdef 
----------------
  SELECT 1;
(1 row)

drop view my_view;

select pg_get_viewdef(151388);

 pg_get_viewdef 
----------------
 Not a view
(1 row) 

Note that it does not mean that my_view does not exist. If you recreate the view it'll have another oid. The only certain conclusion is that your script is not up-to-date (It's inconsistent with the current content of the database). As a remedy you should dump the schema in SQL format, e.g.

pg_dump --schema-only --format=plain my_database > my_database.dump
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda