postgresql - How to declare a record on a user-defined type in postgres -


i have snippet of code in oracle, creating variable of record type

  type t_article record (article_id sch.article.article_id%type,                             short_article_title sch.article.short_article_title%type,                             short_article_text  sch.article.short_article_text%type,                             pub_ts sch.article.pub_ts%type,                             paren_info varchar2(500),                             article_date        sch.article.article_date%type);         v_article_rec       t_article; 

how can declare above code create user defined record in postgres?

i tried using below code in postgres,

type  v_article_rec (article_id sch.article.article_id%type,                         short_article_title sch.article.short_article_title%type,                         short_article_text  sch.article.short_article_text%type,                         pub_ts sch.article.pub_ts%type,                         paren_info varchar2(500),                         article_date sch.article.article_date%type); 

but getting syntax error. kindly help.

in postgres can declare record name record

record variables similar row-type variables, have no predefined structure. take on actual row structure of row assigned during select or command

documentation


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -