{"id":604,"date":"2010-02-07T19:10:19","date_gmt":"2010-02-07T10:10:19","guid":{"rendered":"http:\/\/www.lancard.com\/blog\/?p=604"},"modified":"2025-03-12T11:31:55","modified_gmt":"2025-03-12T02:31:55","slug":"%e8%a4%87%e6%95%b0%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%82%92%e3%81%be%e3%81%9f%e3%81%84%e3%81%a7%e9%87%8d%e8%a4%87%e3%81%97%e3%81%aa%e3%81%84id%e3%82%92%e8%87%aa%e5%8b%95%e7%9a%84%e3%81%ab%e6%8c%af","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2010\/02\/07\/%e8%a4%87%e6%95%b0%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%82%92%e3%81%be%e3%81%9f%e3%81%84%e3%81%a7%e9%87%8d%e8%a4%87%e3%81%97%e3%81%aa%e3%81%84id%e3%82%92%e8%87%aa%e5%8b%95%e7%9a%84%e3%81%ab%e6%8c%af\/","title":{"rendered":"\u8907\u6570\u30c6\u30fc\u30d6\u30eb\u3092\u307e\u305f\u3044\u3067\u91cd\u8907\u3057\u306a\u3044ID\u3092\u81ea\u52d5\u7684\u306b\u632f\u308b\uff08PostgreSQL\uff09"},"content":{"rendered":"<p><code><br \/>\nCREATE TABLE test(id serial, hoge text, primary key(id));<br \/>\nCREATE TABLE test2(id int default nextval(pg_get_serial_sequence(&#039;test&#039;::text,&#039;id&#039;::text)::regclass), hoge text);<\/p>\n<p>INSERT INTO test(hoge) VALUES(&#039;hoge&#039;);<br \/>\nINSERT INTO test2(hoge) VALUES(&#039;hoge&#039;);<br \/>\nINSERT INTO test(hoge) VALUES(&#039;hoge&#039;);<br \/>\n<\/code><\/p>\n<p>PostgreSQL8.1.9\u3067\u78ba\u8a8d\u3002<\/p>\n<p>test\u306eid\u306b\u306f1,3\u304c\u3001test2\u306eid\u306b\u306f2\u304c\u5165\u308a\u307e\u3059\u3002<br \/>\n\u7acb\u3063\u3066\u3044\u308bclass\u306f\u89aa\u3067\u3082\u4f7f\u3048\u3068\u8a00\u3046\u611f\u3058\u3067\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306b\u306fcurrval\u3082\u4f7f\u3048\u307e\u3059\u304c\u3001setval\u3067\u521d\u671f\u5024\u3092\u5fd8\u308c\u305a\u306b\u3002<\/p>\n<p>\u666e\u901a\u306b\u4f7f\u3046\u6a5f\u4f1a\u304c\u7121\u3055\u305d\u3046\u306a\u3082\u306e\u3070\u304b\u308a\u3067\u3002<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604&#038;t=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604&#038;text=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604&#038;title=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=%E8%A4%87%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%82%92%E3%81%BE%E3%81%9F%E3%81%84%E3%81%A7%E9%87%8D%E8%A4%87%E3%81%97%E3%81%AA%E3%81%84ID%E3%82%92%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E6%8C%AF%E3%82%8B%EF%BC%88PostgreSQL%EF%BC%89&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F604\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>CREATE TABLE test(id serial, hoge text, primary key(id)); CREATE TABLE test2(id int default nextval(pg_get_ser [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[135],"class_list":["post-604","post","type-post","status-publish","format-standard","hentry","category-1","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=604"}],"version-history":[{"count":11,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/604\/revisions"}],"predecessor-version":[{"id":4777,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/604\/revisions\/4777"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}