--- src/bin/psql/command.c
+++ src/bin/psql/command.c
@@ -19,6 +19,7 @@
 #include <sys/stat.h>			/* for stat() */
 #include <fcntl.h>				/* open() flags */
 #include <unistd.h>				/* for geteuid(), getpid(), stat() */
+#include <stdlib.h>				/* for getenv() */
 #else
 #include <win32.h>
 #include <io.h>
@@ -526,6 +527,37 @@
 		}
 	}
 
+#ifndef WIN32
+	/* \import an environment */
+	else if (strcmp(cmd, "import") == 0)
+	{
+		char	   *opt0 = scan_option(&string, OT_NORMAL, NULL, false);
+
+		if (!opt0)
+		{
+			/* XXX Not implemented yet */
+			success = true;
+		}
+		else
+		{
+			char	   *opt;
+
+			if  ((opt = getenv(opt0)))
+			{
+				if (!SetVariable(pset.vars, opt0, opt))
+				{
+					psql_error("\\%s: error\n", cmd);
+					success = false;
+				}else	success = true;
+			}else
+			{
+				psql_error("\\%s: error\n", cmd);
+				success = false;
+		}	}
+		free(opt0);
+	}
+#endif
+
 	/* \l is list databases */
 	else if (strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0)
 		success = listAllDbs(false);
@@ -701,6 +733,7 @@
 				/* Check for special variables */
 				if (strcmp(opt0, "VERBOSITY") == 0)
 					SyncVerbosityVariable();
+				success = true;
 			}
 			else
 			{